Trimsdk PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 422

HP TRIM

Software Version: 6.2

TRIM SDK

Document Release Date: May 2009

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:

Software Version number, which indicates the software version.

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:

Search for knowledge documents of interest

Submit and track support cases and enhancement requests

Download software patches

Manage support contracts

Look up HP support contacts

Review information about available services

Enter into discussions with other software customers

Research and register for software training

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

HP TRIM Software Development Kit ........................................................................................................... 8


Using the HP TRIM Software Development Kit........................................................................................ 8
Technical Prerequisites and Assumptions .............................................................................................. 8
Using HP TRIM SDK with .NET Applications ................................................................................. 8
A Short History of the SDK ................................................................................................................... 9
What is the HP TRIM SDK? .................................................................................................................. 9
Better Building Blocks ......................................................................................................................10
Hear, Say ...........................................................................................................................................10
Taking Controls .................................................................................................................................10
The TRIM Object Model.......................................................................................................................11
Objects and Interfaces .......................................................................................................................11
Generic Interfaces..............................................................................................................................11
Base Objects ..................................................................................................................................11
Child Objects .................................................................................................................................12
Collections.....................................................................................................................................12
Collections for Base and Child Objects.........................................................................................12
Methods and Properties .....................................................................................................................13
Common Properties .......................................................................................................................13
Common Methods .........................................................................................................................13
Interactive Methods .......................................................................................................................14
Object Model Diagram ......................................................................................................................15
Using the TRIM Object Model..............................................................................................................17
Database Object.................................................................................................................................17
Working with Base Objects ...............................................................................................................17
Accessing Persistent Objects .........................................................................................................17
Creating a New Object ..................................................................................................................18
Working With Collections of Base Objects.......................................................................................19
Working With Child Objects .............................................................................................................20
Editing Child Objects ....................................................................................................................21
Creating New Child Objects..........................................................................................................21
Deleting Child Objects ..................................................................................................................22
Database Independent Objects...........................................................................................................22
Object Properties ...............................................................................................................................24
Reading Properties.........................................................................................................................24
Updating Properties .......................................................................................................................24
User-Defined Properties ................................................................................................................25
The PropertyDef object .................................................................................................................25
The FieldDefinition Object............................................................................................................26
Acting on TRIM Events ........................................................................................................................26
RecordAddIn .....................................................................................................................................27
FieldAddIn.........................................................................................................................................29
BaseObjectAddIn ..............................................................................................................................31
EventProcessor ..................................................................................................................................33
ActiveX Controls...................................................................................................................................34
Document Viewer - TRIMviewer......................................................................................................35
Edit Box - TRIMedit..........................................................................................................................35
Tree Box - TRIMtreeBox ..................................................................................................................37
Common Scenarios Code Samples.....................................................................................................37
Connecting to a Database ..................................................................................................................38
Connecting to a default database ...................................................................................................39
Connecting to a specific database..................................................................................................40
Allowing the user to choose a Database ........................................................................................41
Code Example C# ......................................................................................................................41
Showing and editing the properties of the TRIM Database object ................................................42

Accessing a Record ...........................................................................................................................45


Getting a Record by Record Number ............................................................................................46
Getting a Record by URI ...............................................................................................................47
Reading Basic Properties...............................................................................................................48
Accessing Related Objects ............................................................................................................49
Accessing Record Location Information .......................................................................................50
Updating Records ..............................................................................................................................51
Modifying Properties.....................................................................................................................52
Calling Update Methods ................................................................................................................53
Updating Properties Using SetProperty.........................................................................................54
Verifying and Error Trapping........................................................................................................55
Saving the Record to the Database ................................................................................................62
Searching for Records .......................................................................................................................63
Creating a RecordSearch Object....................................................................................................64
Adding a Search Clause.................................................................................................................65
Boolean Operators - And, Or, Not.................................................................................................66
User Selected Search Criteria ........................................................................................................67
Applying Filters.............................................................................................................................68
Sorting ...........................................................................................................................................69
Displaying Results.........................................................................................................................70
Processing Results Sequentially ....................................................................................................71
Code Examples Visual Basic.....................................................................................................72
Code Examples C# .....................................................................................................................75
Creating a Container File...................................................................................................................78
Creating a Record of a given Type ................................................................................................79
Controlled and Free Text Titling ...................................................................................................80
Security Levels and Caveats..........................................................................................................81
Access Control...............................................................................................................................82
Relationships .................................................................................................................................84
Record Locations...........................................................................................................................85
Record Contacts.............................................................................................................................86
Code Example - Visual Basic ........................................................................................................87
Code Example - C#........................................................................................................................88
Creating a Document .........................................................................................................................89
Titling and Numbering ..................................................................................................................90
Assigning to a Container ...............................................................................................................91
Attaching an Electronic Document................................................................................................92
Document Author ..........................................................................................................................93
Access Control for Documents......................................................................................................94
Setting User-Defined Fields ..........................................................................................................95
Creating a Record with user input .....................................................................................................96
Code Example Visual Basic .......................................................................................................96
Code Example C# .......................................................................................................................97
Creating a Record with no user input ................................................................................................98
Code Example Visual Basic .......................................................................................................98
Code Example C# .......................................................................................................................99
Checking Out a Document ..............................................................................................................100
Locating the Document ...............................................................................................................100
Check Out Options ......................................................................................................................101
Check In.......................................................................................................................................102
Working with Locations ..................................................................................................................103
Finding a Person by Name...........................................................................................................103
Creating a New Staff Member .....................................................................................................104
Reference.................................................................................................................................................107
Objects.................................................................................................................................................107
ActiveX Controls.................................................................................................................................107

Document Viewer - TRIMviewer....................................................................................................107


Properties.....................................................................................................................................108
Methods .......................................................................................................................................117
Events ..........................................................................................................................................127
Edit Box - TRIMedit........................................................................................................................129
Constituent Controls ....................................................................................................................132
Property Pages .............................................................................................................................135
Properties.....................................................................................................................................139
Methods .......................................................................................................................................185
Events ..........................................................................................................................................218
Tree Box - TRIMtreeBox ................................................................................................................231
Sample Code................................................................................................................................232
Properties.....................................................................................................................................245
Methods .......................................................................................................................................274
Events ..........................................................................................................................................306
Other Objects Used by the ActiveX Controls..................................................................................331
TRIMdateTime ............................................................................................................................332
TRIMfavorites .............................................................................................................................339
TRIMtreeCol ...............................................................................................................................340
TRIMtreeRow..............................................................................................................................358
Enumerated Types for ActiveX Controls ........................................................................................388
dtCannedDate ..............................................................................................................................389
fvFavoriteType ............................................................................................................................390
ksBrowseMode ............................................................................................................................391
ksCannedDatesMode ...................................................................................................................392
ksEditValidMode.........................................................................................................................393
ksScrollMode...............................................................................................................................394
ksSelectMode ..............................................................................................................................395
tbAlignmentMode........................................................................................................................396
tbDisplayMode ............................................................................................................................397
tbEllipsisMode.............................................................................................................................398
ltbSortMode.................................................................................................................................399
tbSortState ...................................................................................................................................400
tbTagMode ..................................................................................................................................401
tbVisibleMode .............................................................................................................................402
TRIMIconId.................................................................................................................................403
vwDocFormat ..............................................................................................................................412
Property Ids .........................................................................................................................................413
What's New from TRIM Captura to the HP TRIM SDK.........................................................................414
Summary of Changes ..........................................................................................................................414
Summary of New Features ..................................................................................................................417
New Objects ....................................................................................................................................417
New Concepts..................................................................................................................................418
New Features In Detail ........................................................................................................................419
Objects.............................................................................................................................................419
Connecting to TRIM........................................................................................................................420
Instantiating Objects ........................................................................................................................421
Creating an Electronic Record.........................................................................................................422

HP TRIM 6 Software Development Kit

HP TRIM Software Development Kit


This document details the usage of the SDK components of HP TRIM.

Using the HP TRIM Software Development Kit


Introduction
This document describes the HP TRIM Software Development Kit (SDK). It provides
an introduction to the design and content of the SDK, it gives instructions and
guidance for using the various tools and objects, and is the logical starting point for
the SDK documentation suite.
For those wanting to understand the capabilities of the SDK, this document can be
read on its own. For those intending to use the SDK it serves as an orientation and
introduction. For a complete technical understanding it is useful to view the
TRIMSDK type library in the object browser of your chosen IDE, where you will find
detailed helpstrings for each object, method and property in the COM Interfaces of
the SDK.
Effective integration of TRIM with other applications using the HP TRIM SDK requires
a technical understanding of the tools in the SDK, as well as a user perspective of
the TRIM application in general and (most importantly) a business understanding of
the particular implementation of TRIM and any other application for which an
integration is required.

Technical Prerequisites and Assumptions


The HP TRIM SDK components are based on Microsoft's Component Object Model
(COM) standard. The SDK documentation assumes the reader is a programmer with
an understanding of COM programming principles, the structure of COM-compliant
object models (i.e. objects, interfaces, methods and properties) and some
experience of using a COM-compliant programming language such as Visual Basic or
C++. The code examples in the documentation are in Visual Basic as well as C#,
although any COM-compliant language can be used with the SDK. The Visual Basic
examples are tested using the Visual Basic 6 compiler, while the C# examples are
tested using Microsoft Visual Studio .NET 2003, requiring the .NET Framework
Version 1.1.

Using HP TRIM SDK with .NET Applications


The HP TRIM Primary Interop Assemblies are integral to the function of the HP TRIM
SDK with .NET applications. These are distributed as .DLL files and contain the .NET
equivalent of the Type Libraries of the HP TRIM SDK.
When developing a new application in .NET , the Assemblies may be referenced from
Visual Studio .NET through right-clicking on References in the Solution Explorer and
browsing to select the necessary .DLL files.

Page 8

HP TRIM 6 Software Development Kit

A Short History of the SDK


In the early days of the TRIM Records & Document Management application (up to
version 4.1), it was generally not possible to programatically access the TRIM
Database without resorting to writing SQL. This was no easy task. The programmer
had to fully understand the data schema and the complex data relationships to
translate a user's requirement into a set of SQL statements. It was even more
daunting if any data was to be modified, as it was necessary for the programmer to
understand the application business rules to avoid corrupting the Database.
To help clients avoid these pitfalls, when version 4.2 of TRIM was released in 1997, it
included an extra program that gave programmatic access to some of the internal
application functionality through an small subset of functions labelled the TRIM API.
By using this API instead of SQL to access the TRIM data, the business rules were
automatically applied and therefore the Database integrity was preserved. The TRIM
4.3 release expanded the capabilities of the API, exposing more of TRIM's underlying
functionality and thereby enabling a wide variety of integration possibilities with
other applications. The business opportunities that this created has ensured that this
version of the API has been widely used as a successful means of seamlessly
integrating TRIM data and functionality into other applications. The TRIM 4.3 API
was an out-of-process COM Automation server, implemented in a file called
"tsapi.exe".
In the version 5.0 release of TRIM, the application has been given a major design
overhaul, creating a more robust, scalable enterprise architecture and a brand new
look-and-feel. As this was a "from-the-ground-up" redevelopment, the API was
replaced by a comprehensive library of functions known as the Software
Development Kit. For the first time, most of the TRIM business functions can be
accessed programatically. This gives the programmer vastly more control over the
application and far greater scope for integration than was previously possible.
The new SDK COM interfaces (of which there are three) are in-process servers
implemented in DLLs.

What is the HP TRIM SDK?


The HP TRIM SDK is a suite of tools that allow programmers to create custom
solutions, services and integrated applications by leveraging the functionality of
TRIM. These tools give TRIM clients and third-party integrators the opportunity to
ERDM-enable line-of-business applications, to create custom document-centric
applications, and to increase the return-on-investment of an organisation's
information assets, such as Classification systems, controlled vocabularies, and
knowledge repositories.
The SDK is an in-process server implemented in a dynamic link library (dll) file. This
method of implementation means that the SDK is loaded into the same memory
space as the application that invokes it. The result is fast execution of methods, and
it also enables a number of separate applications to work with different Databases
through the same component.
At the core of the HP TRIM SDK is a comprehensive model of all business objects in
HP TRIM. All data fields associated with these objects are exposed as properties
through the SDK, and various methods are provided to implement common
application functionality. With very few exceptions, it is possible to programmatically
access via the SDK all aspects of TRIM that are available through the client user
Page 9

HP TRIM 6 Software Development Kit

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.

Better Building Blocks


HP TRIM has been designed in such a way that all the business objects used in the
application are automatically exposed through a thin COM wrapper created
automatically during the application build process. This means that using the HP
TRIM SDK is very efficient, and all the same underlying objects and properties that
the application's programmers use to build the TRIM user interface are also available
to third-party programmers via the SDK.

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

HP TRIM 6 Software Development Kit

The TRIM Object Model

Objects and Interfaces


To understand how objects in the HP TRIM SDK are used, you must have a basic
understanding of objects and interfaces, and how they are used in the Component
Object Model, otherwise known as COM. Interfaces are the key to understanding
COM, and directly affect the way COM objects in the SDK (and other COM-based
object models) are used in code.
An object is an instance of a class, where a class is some common type of entity in
an application. Typical classes of objects in the TRIM application are Records, Record
Types and Locations. Each class of object has properties, which represent the
named data attributes that are present on each instance of the class.

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

Any objects that can be created and


deleted independently.

IBaseChildObject

Any object that can only exist as a


'child' of a Base object.

IBaseObjects

Any collection of Base objects.

IBaseChildObjects

Any collection of Base Child objects.

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

HP TRIM 6 Software Development Kit

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.

Collections for Base and Child Objects


Dependent or Child objects are those that can be manipulated like other objects in
the SDK but which cannot be independently created or saved. These are usually
dependent upon one or more persistent objects in the Database, and often represent
relationships rather than tangible objects. Typically, Child objects are held in
collections that are accessed via a property of their parent object.

Page 12

HP TRIM 6 Software Development Kit

An example of a dependent collection is the AttachedKeywords collection. This can


be used like any other collection object to navigate to the keywords it contains.
However, even though the collection can be modified (by adding or removing
relationships between keyword terms and the record), it is not independently saved.
The information that the child collection represents is saved when the object on
which it is dependent is saved. In the case of the AttachedKeywords example, the
relationship between the record and the AttachedKeyword is saved in the Record
object.

Methods and Properties


In the previous section we discussed the relationship between objects in the Object
Model, and how objects implement predefined interfaces. Each interface is defined
as a specific set of methods and properties, and it is through these that the object
provides its functionality and data.
The definition of each method and property is provided in the reference section of
this documentation. However, most object classes can be used according to generic
processes, and these are discussed in the next sections on the Object Model.

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

Returns the Database object that created this object.

Uri

Returns the internal number that uniquely identifies this


object.

Verified

Returns True if the current state of the object's data is valid.

Type

Returns the object type for this object (for example, Record,
Location etc.)

ErrorMessage

Returns the description of the last error associated with this


object.

Common Methods
As with common Properties, many objects implement Methods with the same (or
similar) names.
Method

Description

GetProperty

Returns the data value of a property identified by a

Page 13

HP TRIM 6 Software Development Kit

property Id.
SetProperty

Sets the data value of a property identified by a property


Id.

GetPropertiesAsString Returns the data values of a set of properties for the


object, as a string formatted for the use specified.
Verify

Checks the validity of the current state of the object's


data.

Save

Saves the current state of the object to the TRIM


Database

Delete

Deletes the object from the TRIM Database.

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

HP TRIM 6 Software Development Kit

Object Model Diagram

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

HP TRIM 6 Software Development Kit

See Previous Page


Databases

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

HP TRIM 6 Software Development Kit

Using the TRIM Object Model

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.

Working with Base Objects


Accessing Persistent Objects
There are generally two ways to access existing persistent objects in the TRIM
Database. The most reliable way is to use the object's URI, as this is guaranteed to
uniquely identify the object. The alternative is to use the object's Name in most
cases this is also unique, but the name of an object can change after it is created,
whereas the URI cannot.
The Database object has a number of methods for accessing different objects by
their URI or Name, all taking the form:
Get<object> (LookForValue as Variant) As <object>
To instantiate an existing object, you must follow these steps:
Declare an object variable of the appropriate object type.
Determine the Name or URI of the object to be instantiated.
From a Database object, call the appropriate Get<object> method, passing the URI
or Name as an argument to the method.
If the identifier is valid, the instantiated object will be returned by the method and
assigned to the object variable.
Visual Basic Example
The following example code instantiates an existing record object with a Record Id of
"RP95/1".
' Declare the object variable
Dim objRecord As TRIMSDK.Record
Dim vntRecId As Variant
' Determine the identifier
vntRecId = "RP95/1"
' Call Get to instantiate the object

Page 17

HP TRIM 6 Software Development Kit

Set objRecord = objTRIM.GetRecord (vntRecId)


' Check that a record with this record number was found
If objRecord Is Nothing Then
Msgbox "Record ID not found or not accessible due to security."
End If

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.");
}

Creating a New Object


All primary persistent objects can be created from the SDK via methods on the
Database object. The format of these methods is "New<Objectname>".
A New<object> method returns a new instance of the specified object type. This
object contains only default information relating to the object type to begin with, and
its properties must be set by code (or by interaction with the user.) Calling the
"Save" method on the object commits the data to the Database.
The process for creating new objects is therefore as follows:
1.

Define an object variable of the type <Object>.

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.

Call the Save method on the <Object> variable.

Visual Basic Example


The following example code creates a new Keyword (Thesaurus Tterm) object.
' Declare the object variable
Dim objKeyword As TRIMSDK.Keyword
' Call New to instantiate the object
Set objKeyword = objTRIM.NewKeyword
' Set properties
objKeyword.Name = "Example"
objKeyword.TopTerm = True
' Save to the Database
objKeyword.Save

C# Example
The following example code creates a new Keyword (Thesaurus Term) object.

Page 18

HP TRIM 6 Software Development Kit

// 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();

Working With Collections of Base Objects


Collections (of Base Objects) are used to manage related groups of objects of the
same type. Collections have several standard methods for iterating through the
individual objects, and most have additional methods for selecting objects to be
included in the collection based on specific criteria.
When a collection is created it is always empty. You must call methods on the
collection to select object items to be included in the collection, based on criteria
such as names or URIs. When the collection contains object items, you can call
methods that act upon the collection as a whole, such as displaying the collection to
the user, making a reference to the collection or printing the items in a Report.
The process for creating and working with collections is as follows:
1.

Define an object variable of the type <Objects>.

2.

On a Database object, call one of the "Make<Objects>" methods.

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.

Call methods to manipulate the collection as a group (see table below of


common collection methods), if required.

5.

To access individual objects in the collection, call ChooseOneUI (user


selection), Next (sequential access), or Item (indexed access). Each of these
will return an instantiated object of the collection's type.

Visual Basic Example


The following example code allows the user to choose a single Record Type from all
the Record Types in the Database.
Dim colRecTypes As RecordTypes
Dim objRecType As RecordType
Set colRecTypes = objTRIM.MakeRecordTypes
Call colRecTypes.SelectAll
Set objRecType = colRecTypes.ChooseOneUI(hWnd)

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

HP TRIM 6 Software Development Kit

SelectAll

Fill the collection with all the objects of its type from the
Database.

SelectByPrefix

Add items to the collection by name prefix.

SelectByUris

Add specific items to the collection. Takes an array of


object URIs.

other "Select"
methods

Add items by other criteria. Different collection types will


implement different selectors.

RefineUI

Allow the user to select items using a search dialog.


! Note: Not all collections provide this method.

Working With Child Objects


Child objects are dependents of base objects, and represent either sub-items of the
base object (for example, Addresses of a Location) or relationships with other base
objects (for example, Keywords attached to a Record).
The only base objects in the TRIM Object Model that have Child objects are Records,
Locations and LookupSets (see the Object Model diagram). The names of Record
child objects are prefixed with "Rec", the names of Location child objects are prefixed
with "Loc", and the name of the LookupSet child objects are prefixed with "Cds".
The generic process for working with Child objects is slightly different to that for
Base objects. Child objects always belong to a collection of "children" that is only
able to be instantiated from the parent object. New child objects can be created by
calling the New method on the collection, and they can be deleted by calling the
Delete method on the child object itself. Any changes to child objects (including
additions and removals) are committed to the Database when the parent object is
saved.
The process for instantiating a collection of child objects is as follows:
1.

Define a collection object variable of the type <ChildObjects>.

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.

Visual Basic Example


The following example code instantiates the collection of Attached Keywords for the
Record "RP95/1", and displays them to the user.
Dim objRecord As Record
Dim colKeywords As RecKeywords
Set objRecord = objTRIM.GetRecord("RP95/1")
Set colKeywords = objRecord.RecKeywords
Call colKeywords.DisplayUI(hWnd)

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

HP TRIM 6 Software Development Kit

TRIMSDK.Record objRecord = db.GetRecord("RP95/1");


TRIMSDK.RecKeywords colKeywords = objRecord.RecKeywords;
int hWnd = Handle.ToInt32();
colKeywords.DisplayUI(hWnd);

Editing Child Objects


The process for editing an existing child object is as follows:
1.

Define an object variable of the type <ChildObject>

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.

Save the parent object.

Visual Basic Example


The following example code modifies the contacts for the Record "G96/201",
changing contacts of type 'Other' into type 'Addressee'.
Dim colContacts As RecLocations
Dim objContact As RecLocation
Set objRecord = objTRIM.GetRecord("G96/201")
Set colContacts = objRecord.RecLocations
For i = 0 To colContacts.Count - 1 ' NB collections are zero-based
Set objContact = colContacts.Item(i)
If objContact.RecLocType = rlContact _
and objContact.Subtype = ctOther Then
objContact.Subtype = ctAddressee
End If
Next
Call objRecord.Save

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();

Creating New Child Objects


Not all Child collections support creation of new objects. The RecRevisions collection,
for example, cannot be explicitly added to because its members are only created
through the process of checking in a document as a new revision.

Page 21

HP TRIM 6 Software Development Kit

The process for creating a new child object is as follows:


1.

Define an object variable of the type <ChildObject>

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.

Save the parent Record or Location.

! 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

Child Object Created

AttachContact

RecLocation

AttachKeyword

RecKeyword

AttachRelationship

RecRelationship

MakeRequest

RecRequest

Deleting Child Objects


Some child objects represent a sub-item of an object (such as a Location Address)
that cannot exist independently of the parent, and deleting the child object therefore
permanently deletes the sub-item from the Database. However, when you delete a
child object that represents a relationship between base items, you are only deleting
the relationship, not the item (for example, deleting the RecKeyword "Marine
Animals" from the RecKeywords collection belonging to Record "RP95/2" simply
detaches the keyword from the record).
The process for deleting a child object is as follows:
1.

Define an object variable of the type <ChildObject>

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.

Call the Delete method on the child object variable.

4.

Save the parent object.

Database Independent Objects


There are a number of objects in the object model that are not dependent on a

Page 22

HP TRIM 6 Software Development Kit

Database object to be used in the SDK. These objects are

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

HP TRIM 6 Software Development Kit

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

' read the Title property


' update the Title property

(Some automation languages require property values to be accessed through special


methods, in which the property name is prefixed with values such as 'get_' to read
and 'put_' to update.)
It is also possible to manipulate object properties through generic methods, by using
TRIM's internal property identifiers to specify a property (see the Property Ids
section), and a variant data type to hold the property's data value. This technique is
discussed in the section on the PropertyDef object.

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

HP TRIM 6 Software Development Kit

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.)

The PropertyDef object


Generic handling of properties of all TRIM objects is managed through the
PropertyDef object and its associated PropertyDefs collection.
A PropertyDef object manages the unique identifier for an object's property, and
provides additional information about the format and structure of the property. It
does not, however, contain the data value of the property.
Individual PropertyDef objects are instantiated by specifying a unique internal
property Id (see the section on Property Ids), or alternatively (and more easily) by
iterating through an instantiated PropertyDefs collection. The collection is
instantiated by calling one of the 'Select' methods exposed by the collection, each
of which takes an argument identifying a base object type (a member of the
btyBaseObjectTypes enumeration.) These methods add property definitions to the
collection for the specified object type, and provide options to select all properties for
the object type, all properties available to the View Pane (or those included on the
view pane by default), all modifiable properties or all properties for a given
subgroup.
Visual Basic 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
value.
Private Sub PrintProperties(objRecord As Record)
Dim objProp As New PropertyDef
Dim colProps As New PropertyDefs
Call colProps.SelectViewPaneItems(btyRecord)
For i = 0 To colProps.Count - 1
Set objProp = colProps(i)
Debug.Print objProp.GetCaption(objRecord.Database) &
" : " & objRecord.GetPropertyAsString(objProp)
Next

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

HP TRIM 6 Software Development Kit

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));
}
}

The FieldDefinition Object


HP TRIM allows a large number of User Defined Fields to be assigned to records.
Therefore User Defined Fields cannot be interrogated using normal named properties
of the record object. Instead, accessing User Defined Fields is carried out using a
dedicated object for managing these fields, the FieldDefinition object, and its
associated FieldDefinitions collection.
The Record object has a pair of methods for manipulating User Defined Fields,
GetUserField and SetUserField. Each method takes a populated FieldDefinition object
as a parameter.

Acting on TRIM Events


There are a number of interfaces allowing the programmer to run custom code in
response to events that occur in HP TRIM. They are:

RecordAddIn

FieldAddIn

BaseObjectAddIn (New in TRIM 6.1)

EventProcessor

Page 26

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Page 28

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Page 30

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Page 32

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Document Viewer - TRIMviewer


The Viewer control enables an application to view a wide variety of file formats
without requiring the file's native application. The viewer control can be sized and
positioned according to the design requirements of the host application. Any file on
the file system can be viewed by the control (not just TRIM documents), so this can
be very useful as a preview control.
(See Reference - ActiveX Controls - TRIMviewer.)

Edit Box - TRIMedit


An Edit Box is a standard control in Windows applications that is used to allow a user
to type in or edit data. TRIM makes extensive use of edit boxes to capture user
input for record metadata and other information. In many cases, TRIM enhances the
standard edit box by providing a 'KwikSelect' button integrated into the control, to
allow the user to interactively select an object from the TRIM Database, or a date
from a calendar, or a file or directory from the local file system, instead of having to
type the correct value manually. Many TRIM edit boxes also provide a history list,
where the user's most recent selections of the same category (for example,
Container files) are available in a drop-down list attached to the control.
(See Reference - ActiveX Controls TRIMedit.)
TRIM provides its own enhanced edit box control in the TRIM 5 and 6 SDK, so
programmers and application designers can take advantage of the features it
provides in custom applications and dialogs. The control can be set to be one of the
following variations:

Custom Browser

Date Picker

Date and Time Picker

Input File Selector

Output File Selector

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

HP TRIM 6 Software Development Kit

Page 36

HP TRIM 6 Software Development Kit

Tree Box - TRIMtreeBox


The TRIM Tree Box control is used to display tabular data, i.e. rows of records with
columns of record attributes. The rows may also be related in a hierarchy or tree
structure, in which case the control will show the data rows in a Windows Explorerstyle tree that can be navigated by the user expanding and collapsing branches.
(See Reference - ActiveX Controls TRIMtreeBox.)
The tree control uses enhanced column headers, which can be added, removed and
reordered programmatically or interactively by the user. The headers can be resized
manually or automatically to fit the data contents, and the user can sort the data by
any column in ascending or descending order simply by clicking on a heading.
Like the other TRIM 5 and 6 ActiveX controls, the Tree control does not require a
connection to a TRIM Database, and it can be used to display non-TRIM data. The
control is configured and populated by passing text strings to methods of the control.
Many of TRIM's SDK objects have special methods that are designed specifically for
the Tree control, converting their data into appropriately formatted strings.

Common Scenarios Code Samples


In this section, various common programming scenarios are discussed, with example
code to illustrate how different tasks can be achieved.

Page 37

HP TRIM 6 Software Development Kit

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();
}

Similarly, if a particular named Database is required, this could also be selected


programmatically from the Databases collection.
In Visual Basic:
For i = 0 to colDBs.Count -1
Set objTRIM = colDBs.Item(i)
If objTRIM.Name = "MyTRIM" Then
objTRIM.Connect
Exit For
End If
Next

In C#:
for ( int i=0; i < colDBs.Count; i++)
{
db = colDBs.Item(i);
if (db.Name == "MyTRIM")
{
db.Connect();
break;
}
}

Page 38

HP TRIM 6 Software Development Kit

Connecting to a default database


This sample code demonstrates connecting to a TRIM Database, when the HP TRIM
Installation is a default database, or there is only one database.
In Visual Basic:
Dim objTRIM As TRIMSDK.Database
Set objTRIM = New TRIMSDK.Database
objTRIM.Connect

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);

If a different (non-default) Database is required, the Databases collection can be


used to select a specific Database.

Page 39

HP TRIM 6 Software Development Kit

Connecting to a specific database


This sample code demonstrates connecting to a specific TRIM Database by setting
the database id.
In Visual Basic:
Dim objTRIM As TRIMSDK.Database
Set objTRIM = New TRIMSDK.Database
objTRIM.Id = 45 45 is the id of the TRIM Demonstration Database
objTRIM.Connect

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

HP TRIM 6 Software Development Kit

Allowing the user to choose a Database


Instantiates a Database selected by the user from a list of Databases.

Code Example Visual Basic


Dim p_TRIMDatabaseCollection As TRIMSDK.Databases
Dim p_TRIMDatabase As TRIMSDK.Database
' Instantiate collection of valid TRIM Databases
Set p_TRIMDatabaseCollection = New TRIMSDK.Databases
' Display the list of Databases.
' Assign the selection to the modular level TRIM Database variable
Set p_TRIMDatabase = p_TRIMDatabaseCollection.ChooseOneUI(hWnd)
If p_TRIMDatabase Is Nothing Then
Debug.Print "User Cancelled!"
Else
Debug.Print "TRIM Database " & p_TRIMDatabase.Name & " is Connected(T/F) - " &
p_TRIMDatabase.IsConnected
End If
' Release object
Set p_TRIMDatabaseCollection = Nothing

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

HP TRIM 6 Software Development Kit

Showing and editing the properties of the TRIM Database object


This sample code demonstrates one method of customising the database properties
in the SDK.

Page 42

HP TRIM 6 Software Development Kit

Code Example Visual Basic


Private m_TRIMDatabase As TRIMSDK.Database
If m_TRIMDatabase.PropertiesUI(hWnd) Then
If m_TRIMDatabase.Verify Then
m_TRIMDatabase.Save
Else
MsgBox "Error Saving Database properties " & m_TRIMDatabase.ErrorMessage,
vbExclamation
End If
Else
Debug.Print "User Cancelled"
End If

Page 43

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Getting a Record by Record Number


Every record in TRIM has a unique Record Number. This follows a pattern defined by
the Record Type and can be manually entered by the user or set to be automatically
generated by TRIM. Although the commonly used term is 'number', it is more
correctly an identifier, as it is a string that may contain alphanumeric characters.
This string is accessible through the Record object's Number property.
The Record Number can be used as the argument to be passed to the Database
object's GetRecord method, which takes a variant for the unique identifier and
returns a pointer to the instantiated Record.
For example, if you wish to instantiate the record 2002/0059, you need to use the
following statement:
In Visual Basic:
Set objRecord = objTRIM.GetRecord ("2002/0059") ' instantiate by number

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

HP TRIM 6 Software Development Kit

Getting a Record by URI


The Unique Row Identifier or URI of a record is an internal unique number that is
transparent to the everyday user of TRIM. It is the primary key on the TSRECORD
table in the Database and provides an internal unique identifier for every record.
To instantiate a record by its URI, you can pass the numeric URI as the argument to
the Database object's GetRecord method.
See the following example:
In Visual Basic:
Set objRecord = objTRIM.GetRecord (130) ' instantiate by URI

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

HP TRIM 6 Software Development Kit

Reading Basic Properties


Most of the metadata directly associated with a record is exposed through properties
on the Record interface. Most properties return primitive data types (strings,
numbers or dates) and can be interrogated directly. The meanings of these
properties are generally self-evident from their names, but are also given in the
object browser and in the reference section.
Examples of basic readable properties of a record are:
Property

Example value

Number
Title

"G1997/0770"
"Greenhouse Journal of Global Warming Dugong Habitats"
#8/20/1997#
"GJGW 97PB"
5617

DateCreated
ExternalId
AccessionNbr

Visual Basic Example


Dim objRec As Record
Set objRec = objTRIM.GetRecord ("G97/770")
If objRec.AccessionNbr > 5000 and objRec.DateCreated < #01/01/2000# Then
Msgbox objRec.Title, , "Record " & objRec.Number
End If

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

HP TRIM 6 Software Development Kit

Accessing Related Objects


Many attributes of a TRIM record represent other objects, such as the RecordType,
Classification and Container attributes. These are properties where the data type of
the property is an object interface reference.
Visual Basic Example
The following code instantiates a record object (in variable objRecord) and then
assigns its Container to another variable (objContainer).
Dim
Dim
Set
Set

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

HP TRIM 6 Software Development Kit

Accessing Record Location Information


A TRIM record has various properties concerning related location information. These
properties of a Record all return an instantiated Location object:

CurrentLoc Current (Assignee) location of the record

HomeLoc Normal location of the record

OwnerLoc Location of the Owner or responsible Organization for the record

AuthorLoc Person who authored the electronic document

CreatorLoc Person who registered the record in TRIM

AddresseeLoc Person to whom the record is addressed

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Calling Update Methods


To update other data on a record where read-write properties are not available, you
must call a method instead. Update methods generally begin with the prefix 'Set'
and they include a parameter for the new data value you wish to apply.
In Visual Basic:
Call objRecord.SetCurrentLocation(objMyUnitLoc);

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

HP TRIM 6 Software Development Kit

Updating Properties Using SetProperty


To update a record's properties where the internal identifier of the property is known
(see Property Ids), you can use the SetProperty method. This requires passing the
property identifier and a variant containing the data value.
In Visual Basic:
' Set the title (property id=3)
Call objRecord.SetProperty(3, "Barrier Reef manatee population figures")

In C#:
// Set the title (property id=3)
objRecord.SetProperty(3, "Barrier Reef manatee population figures");

Page 54

HP TRIM 6 Software Development Kit

Verifying and Error Trapping


When a record object is modified via the SDK, there are two levels of verification that
must be carried out before the changes can be committed to the Database.
The first is field-level verification, which checks that the change to an individual
property is legal. An example would be to check that a Records Date Created is not
in the future. If a property update cannot be carried out because of field-level
verification, the attempt to set the property will cause a run-time error to be raised
and the update will not be carried out.
The second level of validation is object-level verification (sometimes called crossfield verification.) This checks that the values of all fields on the object are consistent
with each other. An example of object-level verification would be that the Date
Registered is not earlier than the Date Created. Object-level verification may be
performed by the objects Verify method. It is also carried out automatically
whenever the object is saved.
Object-level verification for a single property may be performed by the base objects
VerifyProperty method. This checks that the value of a nominated property is
consistent with all other current values for the object. The VerifyProperty method
also sn optional the capability to fail if the property is mandatory and has not been
set.

Page 55

HP TRIM 6 Software Development Kit

The Verify Method


The Record object (and every other base object) has a Verify method. This can be
called to perform object-level verification prior to saving the object. The method
returns false if there are any errors in the state of the object, and the error
description will be stored in the object's ErrorMessage property. If there are no
errors, the method returns true and the Verified property (see The Verified Property)
is set to true.
The method contains an optional parameter FailOnWarnings which, if set to true, will
cause the Verify method to check for warning conditions as well as error conditions,
and to fail if a warning is encountered.
Visual Basic Example
If Not objRecord.Verify(True) Then
Msgbox objRecord.ErrorMessage,,"Verify Failed"
Else
objRecord.Save
End If

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

HP TRIM 6 Software Development Kit

The VerifyProperty Method


The VerifyProperty method may be used to cross-check the value of a single property
against all other property and field values for the object. It is only available from the
IBaseObject interface for the object. If the VerifyProperty method fails to verify the
property, the objects ErrorMessage property will be populated with the details of the
failure.
The following code example demonstrates a case in which the VerifyProperty method
will fail as a result of assigning an invalid value for the DatePublished property.
Visual Basic Example
'Assuming objTRIM is a connected database object
Dim objRecord As Record
Dim recType As RecordType
Dim baseObj As IBaseObject
Set recType = objTRIM.GetRecordType("Document")
Set objRecord = objTRIM.NewRecord(recType)
objRecord.Title = "Test Record"
objRecord.Save
objRecord.DatePublished = objRecord.DateCreated - 1
Set baseObj = objRecord
'Now we verify the DatePublished property (property id = 111)
'This will fail since the date published must be later than the date created
'and we have not set a value for it
If Not baseObj.VerifyProperty(111, False) Then
MsgBox objRecord.ErrorMessage, , "VerifyProperty failed"
End If

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

HP TRIM 6 Software Development Kit

will fail as a result of not setting a mandatory property.


Visual Basic Example
'Assuming objTRIM is a connected database object
Dim objRecord As Record
Dim recType As RecordType
Dim baseObj As IBaseObject
Set recType = objTRIM.GetRecordType("Document")
Set objRecord = objTRIM.NewRecord(recType)
Set baseObj = objRecord
'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 Not baseObj.VerifyProperty(3, True) Then
MsgBox objRecord.ErrorMessage, , "VerifyProperty failed"
End If

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

HP TRIM 6 Software Development Kit

The Verified Property


Base objects also have a Verified Boolean read-only property, which is false
whenever the object is instantiated. It is set to true when the Verify method
confirms that it is in a legal state to be saved to the Database.
Visual Basic Example
The following code demonstrates how the Verified property changes according to the
state of the object.
' To demonstrate the Verified property
Dim objTRIM As TRIMSDK.Database
Set objTRIM = New TRIMSDK.Database
' Instantiate the Record
Dim objRecord As TRIMSDK.Record
Dim msg As String
Dim oldTitle As String
Set objRecord = objTRIM.GetRecord("02/59")
msg = "The Record object has just been instantiated. Verified property is set to: " &
objRecord.Verified
MsgBox (msg)
' Verify the Record, with default FailOnWarnings = false
objRecord.Verify (False)
msg = "The Record has just been verified. Verified property is set to: " &
objRecord.Verified
MsgBox (msg)
oldTitle = objRecord.Title
msg = "Would you like to change the title of the Record?"
If MsgBox(msg, vbYesNo, vbQuestion) = VbMsgBoxResult.vbYes Then
objRecord.Title = "new Title"
msg = "The title of the Record has just been changed. The Record has not yet been
checked for internal consistency. Verified property is set to: " & objRecord.Verified
MsgBox (msg)
Else
msg = "No changes have been made, so the Record is still internally consistent.
Verified property is set to: " & objRecord.Verified
MsgBox(msg)
End If
' now save the changes if the object is verified
If Not objRecord.Verified Then
If objRecord.Verify() Then
objRecord.Save
msg = "The changes made to the Record have been verified, and it has just
been saved (so the changes are now committed to the Database). The Verified property is
now set to: " & objRecord.Verified
MsgBox (msg)
Else
msg = "Record Verify failed:" & objRecord.ErrorMessage & ". Because of
this, it has not been saved."
MsgBox (msg)
End If
Else
msg = "Record was verified, so there were no changes to save.")
MsgBox(msg)
End If
MsgBox ("Reverting back to original title of record...")
objRecord.Title = oldTitle
objRecord.Save

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

HP TRIM 6 Software Development Kit

// Instantiate the Record


TRIMSDK.Record objRecord = db.GetRecord("02/59");
MessageBox.Show("The Record object has just been instantiated. Verified property is set
to: " + objRecord.Verified);
// Verify the Record, with default FailOnWarnings = false
objRecord.Verify(false);
MessageBox.Show("The Record has just been verified. Verified property is set to: " +
objRecord.Verified);
string oldTitle = objRecord.Title;
if (MessageBox.Show("Would you like to change the title of the Record?","",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
objRecord.Title = "new Title";
MessageBox.Show("The title of the Record has just been changed. The Record has
not been checked for internal consistency. Verified property is set to: " +
objRecord.Verified);
}
else
{
MessageBox.Show("No changes have been made, so the Record is still internally
consistent. Verified property is set to: " + objRecord.Verified);
}
// now save the changes if the object is verified
if (! objRecord.Verified)
{
if (objRecord.Verify(false))
{
objRecord.Save();
MessageBox.Show("The changes made to the Record have been verified, and it
has just been saved (so the changes are now committed to the Database). The Verified
property is now set to: " + objRecord.Verified);
}
else
{
MessageBox.Show("Record Verify failed:" + objRecord.ErrorMessage + ".
Because of this, it has not been saved. The Verified property is now set to: " +
objRecord.Verified);
}
}
else
{
MessageBox.Show("Record was verified, so there were no changes to save. The
Verified property is now set to: " + objRecord.Verified);
}
MessageBox.Show("Reverting back to original title of record...");
objRecord.Title = oldTitle;
objRecord.Save();

Page 60

HP TRIM 6 Software Development Kit

Trapping Run-Time Errors


It is up to the programmer to determine how they wish to deal with possible errors
when updating an object. However, they must be aware that error checking takes
place even when directly updating properties, so it will be necessary to provide some
error-trapping code to prevent run-time errors being displayed to the user if there is
a possibility of errors being raised.

Page 61

HP TRIM 6 Software Development Kit

Saving the Record to the Database


All of the update methods and property changes made through the Record interface
are only applied to the object in memory. The changes are not committed to the
TRIM Database until the object is saved.
Calling the Save method on the record object will commit the changes to the
Database, applying all updates since the object was instantiated (or since it was last
saved).
! Note: that if the record has not been verified, Save will automatically call the
Verify method and will only commit the changes if the verification succeeds.
Visual Basic Example
Set objRecord = objTRIM.GetRecord("G97/770")
With objRecord
.Title = .Title & " plus New Part of Title"
.DateDue = #1/1/2003#
Set .AuthorLoc = objTRIM.CurrentUser
Call .Save ' commit all these changes to the Database
End With

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

HP TRIM 6 Software Development Kit

Searching for Records


One of the most powerful features of TRIM is the wide range of search criteria that
can be applied to select records from the Database. The SDK has many features
available for creating complex and sophisticated searches, yet it can also be used
with a minimum of code.
The RecordSearch object enables TRIM records to be retrieved by creating a search
expression from a number of search clauses, and has methods to navigate the
records that meet the search criteria. The RecordSearch object also allows boolean
and, or and not relationships to logically combine search clauses, and setting filters
and sort criteria. The object also has file functions for saving searches to or loading
from disk.
To set the search criteria for a record search, you can either call search clause
methods explicitly, or display the TRIM search dialog to allow the user to specify the
search criteria, or a combination of the two.
The process of searching for records via the SDK is as follows:
1.

Construct a RecordSearch object

2.

Add a search clause

3.

Add additional clauses and combine them with logical operators (optional)

4.

Apply Record Type filters (optional)

5.

Display the criteria to the user (optional)

6.

Execute the search query

7.

Process the results sequentially, or

8.

Copy the results to a record collection.

Visual Basic Example


Dim objSearch As RecordSearch
Dim colRecords As Records
' Construct a new search object
Set objSearch = objTRIM.NewRecordSearch
' Search for "reef" in record titles
Call objSearch.AddTitlewordClause("reef")
' Hold the results in a collection
Set colRecords = objSearch.GetRecords

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

HP TRIM 6 Software Development Kit

Creating a RecordSearch Object


Like any other object, the RecordSearch object must be constructed by the Database
object, in this case using the NewRecordSearch method. A RecordSearch object is a
temporary object, and therefore does not need to be instantiated from the Database
(the exception to this is Saved Searches, which will be covered later.)
Visual Basic Example
Dim objSearch As RecordSearch ' declare the search object
Set objSearch = objTRIM.NewRecordSearch ' make the object
Call objSearch.EditQueryUI(hWnd) ' call methods on the object

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

HP TRIM 6 Software Development Kit

Adding a Search Clause


Once you have created the search object, you must then add at least one search
clause before it can be executed to return results. There are many different search
clauses available; the full list can be found in the Reference section.
For example, to retrieve records that contain the word "reef" within the title, you
would add a Title Word clause passing the argument "reef", as follows:
In Visual Basic:
objSearch.AddTitlewordClause("reef") ' search for titles with "reef"

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

HP TRIM 6 Software Development Kit

Boolean Operators - And, Or, Not


An advanced search can be constructed by combining several search clauses with the
Boolean operators 'And', 'Or' and 'Not'. When a Boolean operator is applied to two
clauses (or one in the case of 'Not') the result is a single clause. This resultant
clause can also be the subject of another Boolean operation.
The sequence in which these clauses and operators must be declared in the search
object is known as Reverse Polish Notation. Clauses (or 'operands') are declared
first, and then an Operator is declared. This operates on the last two declared
clauses (or the last one for a 'Not' operation). The clauses affected by the operation
are replaced by a single clause representing the Boolean combination.
For example, consider the following sequence of declarations:
Clause: A
Clause: B
Operator: Not
Operator: And

This results in the logical proposition: 'A and (not B)'.


Another example, this time using RecordSearch object methods:
In Visual Basic:
objSearch.AddTrayClause(ttWorkTray)
objSearch.AddDateCreatedClause(Date, Date)
objSearch.AddCaveatClause("Medical in Confidence")
objSearch.Not
objSearch.And
objSearch.Or
objSearch.AddLocationClause(objAdminLoc, ltCurrent)
objSearch.And

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

HP TRIM 6 Software Development Kit

User Selected Search Criteria


In many cases the programmer will not know the details of the search criteria and
instead will delegate the search criteria to the user. To do this, you can call the
RecordSearch object's EditQueryUI method. This will display the TRIM Search dialog
to the user and update the object's search criteria according to their selections.
You can pre-populate the search criteria by calling a search method before calling
the EditQueryUI method. If you specify multiple search methods prior to calling it,
the Advanced Search dialog will be displayed.
Visual Basic Example
Set objSearch = objTRIM.NewRecordSearch
Call objSearch.AddTitleWordClause("Press")
Call objSearch.AddDateRegisteredClause((Date 1), Date)
Call objSearch.And
If Not objSearch.EditQueryUI(hWnd) Then
Exit Sub ' (Search dialog cancelled)
End If

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Processing Results Sequentially


If there is no need to display the search results or to handle them as a collection of
records, they can be retrieved one at a time by repeatedly calling the Next method.
This returns a single Record object each time it is called (returning a null object
when there are no more records to return.)
Code Example Visual Basic
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.
Dim sCosts(12) As Single
Dim iMonth As Integer
' Get the user-defined field "Actual Cost"
Dim objCost As FieldDefinition
Set objCost = objTRIM.GetFieldDefinition("Actual Cost")
' Create the search
Set objSearch = objTRIM.NewRecordSearch
Call objSearch.AddTitleWordClause("Project Cost Report")
' Process the results in a loop
Set objRecord = objSearch.Next
Do Until objRecord Is Nothing
iMonth = Month(objRecord.DateCreated)
sCosts(iMonth) = sCosts(iMonth) + objRecord.GetUserField(objCost)
Set objRecord = objSearch.GetNext
Loop

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

HP TRIM 6 Software Development Kit

Code Examples Visual Basic

Simple Record Search


Adds a TitleWord clause to the Record Search object to find a specified
indexed Word.
The user to selects a record and instantiates a Record.

Methods
o

AddTitleWordClause

GetRecords

ChooseOneUI

Properties
o

ErrorMessage

Visual Basic Code:


// Assumes TRIMDatabase is a valid TRIMSDK Database
// Instantiate a new TRIM record search object
Set RecordSearch = TRIMDatabase.NewRecordSearch
If Not RecordSearch.AddTitleWordClause(txtLookFor.Text) Then
MsgBox "Add Title Word Clause error " & RecordSearch.ErrorMessage, vbExclamation
Exit Sub
End If
// Fill the Records Collection from the Search object
Set RecordResults = RecordSearch.GetRecords
// Instantiate a record by choosing it from the collection
Set RecordItem = RecordResults.ChooseOneUI(hWnd)
If RecordItem Is Nothing Then
Debug.Print "User cancelled!"
Else
Debug.Print RecordItem.Number & " - " & RecordItem.Title
End If

Page 72

HP TRIM 6 Software Development Kit

Boolean Or Record Search


Record search - Adds two TitleWord clauses with an Or to the Record Search
object in order to find records with title words of txtSearch1.Text or
txtSearch2.Text.
The user to selects a record and instantiates a Record.

Methods
o

AddTitleWordClause

Or

GetRecords

ChooseOneUI

Properties
o

ErrorMessage

Visual Basic Code:


' Assumes TRIMDatabase is a valid TRIMSDK Database
' Instantiate a new TRIM record search object
Set p_RecordSearch = TRIMDatabase.NewRecordSearch
If Not p_RecordSearch.AddTitleWordClause(txtSearch1.Text) Then
MsgBox "Add Title Word Clause error " & p_RecordSearch.ErrorMessage, vbExclamation
Exit Sub
End If
If Not p_RecordSearch.AddTitleWordClause(txtSearch2.Text) Then
MsgBox "Add Title Word Clause error " & p_RecordSearch.ErrorMessage, vbExclamation
Exit Sub
End If
If Not p_RecordSearch.Or Then
MsgBox "Adding Boolean 'OR' failed " & p_RecordSearch.ErrorMessage, vbExclamation
Exit Sub
End If
' Fill the Records Collection from the Search object
Set p_RecordResults = p_RecordSearch.GetRecords
' Instantiate a record by choosing it from the collection
Set p_RecordItem = p_RecordResults.ChooseOneUI(hWnd)
If p_RecordItem Is Nothing Then
Debug.Print "User cancelled!"
Else
Debug.Print p_RecordItem.Number & " - " & p_RecordItem.Title
End If

Page 73

HP TRIM 6 Software Development Kit

Saved Search
Create a Saved Search. Save the record search object.

Methods
o

PropertiesUI

Verify

Save

Properties
o

Name

ErrorMessage

Visual Basic Code:


' Display the properties of a RecordSearch object
' returns True if the user presses OK
If p_RecordSearch.PropertiesUI(hWnd) Then
If p_RecordSearch.Verify(True) Then
' If no errors or warnings, Save the Record Search
p_RecordSearch.Save
MsgBox "Saved Search created - " & p_RecordSearch.Name, vbInformation
Else
' Display Errors
MsgBox "Record Search Verify failed: " & p_RecordSearch.ErrorMessage,
vbExclamation
End If
End If

Page 74

HP TRIM 6 Software Development Kit

Code Examples C#

Simple Record Search


Adds a TitleWord clause to the Record Search object to find a specified
indexed Word.
The user to selects a record and instantiates a Record.

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

HP TRIM 6 Software Development Kit

Boolean Or Record Search


Record search - Adds two TitleWord clauses with an Or to the Record Search
object in order to find records with title words of txtSearch1.Text or
txtSearch2.Text.
The user to selects a record and instantiates a Record.

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Creating a Container File


This scenario describes the general processes for using the SDK to create a record of
a generic Record Type we are calling a 'Container File'. In this and the next scenario
(Creating a Document) we are assuming that the reader is familiar with the concept
of Record Types. These are described in HP TRIM Help Administrator Guide
Record Types.
While it is up to the Administrator of each TRIM implementation to determine the
Record Types to be used, it is typical to follow a standard records management
practise of having at least two Record Types, one representing Container Files (or
Folders) and one representing Documents (the actual names used for the Record
Types may of course vary.) Container Files are usually created and maintained by
specialist records managers, as it is generally at this level that Classification
systems, Retention Schedules, Security, Thesaurus Terms (keywords), controlled
titling and other records management metadata are applied. 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 all other metadata and context is inherited from the Container.
The general steps for creating a new Container File record are as follows:
1.

Instantiate the appropriate Record Type object

2.

Instantiate a new Record object of this Type

3.

Identify the Classification or Keywords for titling the record (optional)

4.

Set the free text title

5.

Assign Security Levels and Caveats (optional)

6.

Relate the record to associated Locations (optional)

7.

Relate to other records (optional)

8.

Assign other metadata or User Defined Fields (optional)

9.

Assign a record identifier

10.

Save the Record object.

Page 78

HP TRIM 6 Software Development Kit

Creating a Record of a given Type


When creating any record, the Record Type for the new record must be identified.
This can be done programmatically if the Record Type's URI or Name is known at
design-time, or the choice may be given to the user at run-time. In either case, the
end result is to instantiate an existing Record Type object (using the GetRecordType
method), and to pass this object to the Database object's NewRecord method.
In Visual Basic:
' Create a new Case File record
Set objRecType = objTRIM.GetRecordType("Case File")
Set objRecord = objTRIM.NewRecord(objRecType)

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

HP TRIM 6 Software Development Kit

Controlled and Free Text Titling


Titles for Container Files are often subject to controlled vocabulary or Classification
structures such as a Thesaurus or Classification (file) plan, which give records
managers greater control over file creation, retrieval and Retention. Even when such
controlled titling is used, each file will typically also have a 'free text' title part. The
titling method used is determined by the Record Type, and is usually set by the TRIM
Administrator. Thus a record with Classification titling may have a title such as:
"Insurance Property Storm damage to Mackay information center", where the
first two terms are generated from a predefined hierarchical Classification structure
and the remaining part of the title is 'free text' describing the specifics of the file.
The generated title terms are determined by the Classification codes, usually defined
as a numerical sequence such as "610/600/". The free text title is set via the
TypedTitle property.
Visual Basic Example
If objRecordType.TitlingMethod = tmClassification Then
' Assign classification of 610/600/ = Insurance Property
objRecord.Classification = objTRIM.GetClassification("610/600/")
End If
objRecord.TypedTitle = "Storm damage to Mackay information center"

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

HP TRIM 6 Software Development Kit

Security Levels and Caveats


The security profile of an individual TRIM record is governed by three security
controls: a Security Level, a set of zero or more Caveats, and Access Control.
(See TRIM.chm Administrator Guide Ch1 - Security.)
Access Control is discussed in the next section.
Security Levels and Caveats determine the access that a TRIM user has to the
metadata of a record. These security specifications are usually applied to Record
Types (and inherited by records of each type when they are created) but can be set
explicitly on individual records. Every user has a maximum Security Level and zero
or more Caveats in order to access a particular record, the user must have the
same or a higher Security Level and must have all the Caveats associated with the
record.
Assigning Security Levels and Caveats to a record via the SDK is straightforward.
Both the SecurityLevel object and the SecurityCaveat object can be instantiated by
full name or by abbreviation. The instantiated SecurityLevel object is assigned to the
record's SecLevel property. Each instantiated SecurityCaveat object can be passed
to the record's AddCaveat method.
Visual Basic Example
Dim objCav as SecurityCaveat
Dim objSec as SecurityLevel
' Assign "Confidential" level
Set objSec = objTRIM.GetSecurityLevel("Confidential")
Set objRecord.SecLevel = objSec
' Assign "Research Projects" Caveat
Set objCav = objTRIM.GetSecurityCaveat("Research Projects")
Call objRecord.AddCaveat(objCav)
' Assign "Staff in Confidence" Caveat
Call objRecord.AddCaveat(objTRIM.GetSecurityCaveat("Staff in Confidence"))

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"));

! Note: that it is also possible to assign a string value of comma-separated


Security Level and Caveat names (not abbreviations) to the Record object's
Security property. If the string can be completely parsed into legal security
values, they will be assigned to the record. The following code produces the
same result as the example above:
Visual Basic Example
' Assign security level and two Caveats
objRecord.Security = "Confidential, Research Projects, Staff in Confidence"

C# Example
// Assign security level and two Caveats
objRecord.Security = "Confidential, Research Projects, Staff in Confidence";

Page 81

HP TRIM 6 Software Development Kit

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

viewing the electronic object

updating the electronic object

deleting the record

changing Access Control details

Each action can be granted access as follows:

Public (all users)

Private (only one user)

Inherited (same access as the Container record)

Ad hoc (a set of named locations)

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:

Public access to view the metadata

Inherited access to update the metadata

Only the Records Manager can delete the record.

! 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:

Public access to view the metadata

Page 82

HP TRIM 6 Software Development Kit

Inherited access to update the metadata

Only the Records Manager can delete the record.

! 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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Code Example - Visual Basic


This code demonstrates many of the features described above. The code will work
with the Demonstration Database provided on the TRIM installation disk.
Dim objTRIM As New Database
Dim objRecord As Record
Dim objRecordB As Record
' Create a new File Folder record
Set objRecordType = objTRIM.GetRecordType("Research Project File")
Set objRecord = objTRIM.NewRecord(objRecordType)
With objRecord
' Set keyword title and free text title
.GeneratedTitle = "Administration - Finance - Donations"
.TypedTitle = "Bequest from the estate of Lady Marchcroft"
' Relate to the superseded record
Set objRecordB = objTRIM.GetRecord("76/915")
Call .AttachRelationship(objRecordB, rrDoesSupersede)
' Assign "Confidential" security level
.SecLevel = objTRIM.GetSecurityLevel("Confidential")
' Add "Research Projects" Caveat
Call .AddCaveat(objTRIM.GetSecurityCaveat("Research Projects"))
' Access Control - only this user can update
Call .SetAccessControlDetails(dxUpdateMetadata, asPrivate, objTRIM.CurrentUser)
' Locations
Call .SetHomeLocation(objTRIM.GetLocation("Administration"))
Call .SetCurrentLocation(objTRIM.CurrentUser)
' Contacts
Call .AttachContact(objTRIM.CurrentUser, ctAuthor, True)
Call .AttachContact(objTRIM.GetLocation("Bay Books"), ctClient)
' Verify and Save
If Not .Verify Then
MsgBox .ErrorMessage
Else
.Save
End If
End With

Page 87

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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.

Instantiate the appropriate Record Type object

2.

Instantiate a new Record object of this Type

3.

Identify the Container File for the document

4.

Set the free text title

5.

Attach an Electronic file

6.

Assign the record's Author or other contacts (optional)

7.

Set Access Control to the elecronic document (optional)

8.

Assign other metadata or User Defined Fields (optional)

9.

Save the Record object.

Page 89

HP TRIM 6 Software Development Kit

Titling and Numbering


Titling for documents is generally straightforward free text titling is the norm, and
the title simply needs to succinctly describe the document or record. Record
numbers may be assigned explicitly or they may be automatically generated this is
configured on the Record Type properties. If the number is explicitly assigned, the
number (in expanded format) must be assigned to the LongNumber property (it
must be unique or the record will not be saved.)
Visual Basic Example
objRecord.Title = "Letter from executor regarding disbursements of Lady Marchcroft's
bequest"
objRecord.LongNumber = "XK/008934"

C# Example
objRecord.Title = "Letter from executor regarding disbursements of Lady Marchcrofts
bequest";
objRecord.LongNumber = "XK/008936";

Page 90

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Attaching an Electronic Document


Document records can represent physical paper documents, but mostly they will
include an electronic attachment, whether this is a word-processing document,
scanned image or other type of file.
To attach an electronic document to a record, the file name and path must be used
to instantiate an InputDocument object. This object is then passed as an argument
to the record object's SetDocument method. The method includes parameters for
specifying whether this should replace any existing document (or be added as a new
revision), whether it should be marked as checked out to the current user, and any
comments to be added to the record's Notes field.
Visual Basic Example
Dim objDoc As New InputDocument
Call objDoc.SetAsFile("C:\myDocs\ThisFile.doc")
Call objRecord.SetDocument(objDoc, False, False, "Created via SDK")

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Access Control for Documents


For more information on this subject, see Searching for Records - Access Control.
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.) For Document records, the typical action is to assign
View and Update rights to the electronic document.
Visual Basic Example
This example grants the following:

Private access to the connected user for updating the electronic document

Public access to view the Document.

Call objRecord.SetAccessControlDetails(dxUpdateDocument, asPrivate, objTRIM.CurrentUser)


Call objRecord.SetAccessControlDetails(dxViewDocument, asPublic)

C# Example
This example grants the following:

Private access to the connected user for updating the electronic document

Public access to view the Document.

objRecord.SetAccessControlDetails(dxRecordAccess.dxUpdateDocument,
asAccessControlSettings.asPrivate, db.CurrentUser);
objRecord.SetAccessControlDetails(dxRecordAccess.dxViewDocument,
asAccessControlSettings.asPublic,null);

Page 94

HP TRIM 6 Software Development Kit

Setting User-Defined Fields


Any type of record can have any number of User Defined Fields associated with it.
(For background information on User Defined Fields, see Object Properties - The
FieldDefinition Object)
To assign values to User Defined Fields on a record, you must instantiate a
FieldDefinition object representing the User Defined Field, and pass this and a
Variant containing the data value to the Record object's SetUserField method.
Visual Basic 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.
Call objRecord.SetUserField(objTRIM.GetFieldDefinition("Job Code"), "D0933")

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

HP TRIM 6 Software Development Kit

Creating a Record with user input


Code Example Visual Basic
' Modular level (m_)
Private m_TRIMDatabase As TRIMSDK.Database
' Procedural level
Dim p_RecordTypes
Dim p_RecordType
Dim p_NewRecord

variables (p_)
As TRIMSDK.RecordTypes
As TRIMSDK.RecordType
As TRIMSDK.Record

' Instantiate a collection of Record Types.


Set p_RecordTypes = m_TRIMDatabase.MakeRecordTypes
' Fill the collection with all Record Types, before filtering
p_RecordTypes.SelectAll
' Instantiate a Record Type by choosing it from the collection
Set p_RecordType = p_RecordTypes.ChooseOneUI(hWnd)
If p_RecordType Is Nothing Then
Debug.Print "User pressed Cancel"
Exit Sub
End If
' Instantiate a new Record of the Record Type passed in.
Set p_NewRecord = m_TRIMDatabase.NewRecord(p_RecordType)
' Display the properties of new Record
' Returns True if the user selects OK.
If p_NewRecord.PropertiesUI(hWnd) Then
If p_NewRecord.Verify Then
p_NewRecord.Save
MsgBox "Created a new record - " & p_NewRecord.Number
Else
MsgBox "Error saving new Record properties " & _p_NewRecord.ErrorMessage,
vbExclamation
End If
End If
' Clean Up
Set p_RecordTypes = Nothing
Set p_RecordType = Nothing
Set p_NewRecord = Nothing

Page 96

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Creating a Record with no user input


Code Example Visual Basic
' Modular level (m_)
Private m_TRIMDatabase As TRIMSDK.Database
' Procedural level
Dim p_RecordTypes
Dim p_RecordType
Dim p_NewRecord

variables (p_)
As TRIMSDK.RecordTypes
As TRIMSDK.RecordType
As TRIMSDK.Record

Set m_TRIMDatabase = New TRIMSDK.Database


On Error GoTo err_handler
'// Instantiate a Record Type from its name or Uri
Set p_RecordType = m_TRIMDatabase.GetRecordType("Research Project File")
If p_RecordType Is Nothing Then
'// Name or Uri did not uniquely identify a record type.
Debug.Print "Error instantiating Record Type."
Exit Sub
End If
Set p_HomeLocation = m_TRIMDatabase.GetLocation("Llewellyn, Brian (Professor) OBE")
If p_HomeLocation Is Nothing Then
'// Name or Uri did not uniquely identify a TRIM Location.
Debug.Print "Error instantiating Location: " & p_RecordType.ErrorMessage
Exit Sub
End If
'// Instantiate a new Record of the Record Type passed in.
Set p_NewRecord = m_TRIMDatabase.NewRecord(p_RecordType)
'// Complete all of the new record's properties.
With p_NewRecord
'// An error is raised if any of these properties fail.
'// Thesaurus titling
.GeneratedTitle = "ADMINISTRATION - FINANCE - LEASES AND RENTAL AGREEMENTS SUPPLIER [Larger than Life Ventures]"
' p_Keyword.Name
'// Free text titling
.TypedTitle = "New Record Title"
'// Record's Home location
.SetHomeLocation p_HomeLocation
If p_NewRecord.Verify Then
p_NewRecord.Save
Debug.Print "Created a new record - " & p_NewRecord.Number
Else
MsgBox "Error saving new Record" & p_NewRecord.ErrorMessage, vbExclamation
End If
End With
Set p_RecordType = Nothing
Set p_NewRecord = Nothing
Set p_HomeLocation = Nothing
Exit Sub
err_handler:
'// The error message is also populated in the Err object.
MsgBox "Error: " & Err.Description, vbExclamation
Set p_RecordType = Nothing
Set p_NewRecord = Nothing
Set p_HomeLocation = Nothing

Page 98

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Checking Out a Document


When an electronic document in TRIM needs to be updated, it must first be checked
out to a user, to prevent others from attempting to edit the same document. On
completion of the changes, it can be check-in to make the updated version available
in TRIM.

Locating the Document


Various methods can be used to locate and instantiate the document that is to be
checked out. If the unique identifier (Record Number or URI) is known, it can be
passed to the Database object's GetRecord method. Alternatively the record can be
located by the user, either through an interactive search or by selecting from the
contents of a specific Container file.
Visual Basic 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.
Dim objContainer As Record
Dim objDoc As Record
Dim colContents As Records
Set objContainer = objTRIM.GetRecord("96/715")
Set colContents = objTRIM.MakeRecords
Call colContents.SelectContentsOf(objContainer)
Set objDoc = colContents.ChooseOneUI(hWnd)
If Not objDoc.IsElectronic Then
Exit Sub
End If

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

HP TRIM 6 Software Development Kit

Check Out Options


Once the appropriate electronic document has been identified and instantiated, the
object can be programmatically checked out to a specific file destination by calling
the GetDocument method.
Visual Basic Example
If objDoc.IsElectronic Then
Call objDoc.GetDocument("C:\tmp\MyFile.doc", True, "Checked out via SDK")
End If

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Working with Locations


The Location object is an encapsulation of all properties and methods associated with
Persons, Organizations, Positions and Groups. Locations can be identified by name
or by URI, and can be selected on other criteria, such as date of birth, nicknames, or
membership of a particular organization, role or group.

Finding a Person by Name


Although the names of non-persons (Units, Positions and Organizations) must be
unique, this is not the case for persons (Staff Names & Contacts). However, TRIM
allows you to store a 'nickname' for any person, and this can be used as a substitute
for a persons name when searching.
To find a particular person by name, you must pass the person's combined name and
title to the Database object's GetLocation method.
Visual Basic Example
Dim objLoc As Location
Set objLoc = objTRIM.GetLocation("Abbott, Peter (Mr)")

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

HP TRIM 6 Software Development Kit

Creating a New Staff Member


To create a new staff member, you must instantiate a new location by calling the
NewLocation method on the Database object. You then define the type of the
location by assigning a value (in this case lcPerson) to the LocType property. You
can then set various properties representing the person's name, contact details such
as telephone numbers and addresses, administrative details such as employee ID
numbers and so on.
If the new person is to be a TRIM user, then there are login and security details to be
provided. You will need to specify the user's network login ID and optionally an
expiry date. For the security profile, you are required to either explicitly state the
user's Security Level (and optionally any Caveats) and a user category, or if rolebased security is used you can specify that the user takes the profile of a predefined
group or user.
Relationships such as membership of units or reporting lines are created using the
AddRelationship method and passing parameters for the related location and the
relationship type.
Addresses (including electronic addresses such as email or URL) are added by calling
the New method on the LocAddresses or LocEAddresses collection properties.

Page 104

HP TRIM 6 Software Development Kit

Code Example Visual Basic


Dim
Dim
Dim
Dim
Dim
Dim
Dim

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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.

Document Viewer - TRIMviewer


The TRIMviewer is a control that can view documents of a range of file types. It is
used in HP TRIM to display electronic documents attached to TRIM records. It does
not require the native application to function. It is for display only so the document
displayed cannot be edited, though it can be printed. There are a number of
occasions where such a viewer is useful.
Confirmation, if a user is about to check out a document for editing or about to save
a document into TRIM from a directory, providing the ability to view the document
prior to executing the operation can be useful.
Resource tool, there might be a need for a user to see information that is on an
electronic document attached to a TRIM record (for example, A Client contract so
that when a client calls the help line the help officer can lookup the client file and see
the contract).

Page 107

HP TRIM 6 Software Development Kit

Properties
Name

Description

CanSaveOrLaunchCurrent

Activates the SaveCurrent and LaunchCurrent


methods

DocFormat

Format of the viewer document

Enabled

Whether the window is enabled for input.

Font

Control font

MenuHandle

HMENU handle.

PermitLaunch

Returns/sets the ability to launch the viewers


file in its native application

StatusText

Returns a number that indicates which


message is to be displayed given that the
viewer cannot view the selected file.

Text

Returns/Sets a string that is displayed in the


TRIMviewer control when there is no file
currently being displayed.

Page 108

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

DocFormat (Read Only)


The format of the document known to the viewer via the View method.
Syntax
[vwDocFormat ] = TRIMviewer.DocFormat

Page 110

HP TRIM 6 Software Development Kit

Enabled
Returns/sets a value that determines whether an object can respond to usergenerated events.
Syntax
TRIMviewer.Enabled = [Boolean]

Page 111

HP TRIM 6 Software Development Kit

Font
Font used by the control.
Syntax
TRIMviewer.Font = [stdole.IfontDisp ]

Page 112

HP TRIM 6 Software Development Kit

MenuHandle (Read Only)


HMenu Handle to a menu, usually a Right Mouse Button menu
Syntax
[Boolean] = TRIMviewer.MenuHandle

Page 113

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

StatusText (Read Only)


Returns a number that indicates which message is to be displayed given that the
viewer cannot view the selected file.
Syntax
[Long] = TRIMviewer.StatusText

Page 115

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Methods
Name

Description

CanView

Determines if the viewer is able to view the file

Copy

Copy Selection to the Clipboard

Clear

Clears the current file from the viewer

DoMenu

For internal use only

EnableMenu

For internal use only

LaunchCurrent

Launch a copy of the current document in the associated


application

Print

Prints the defined file

PrintCurrent

Prints the file that the viewer is currently viewing

View

Views the defined file

Page 117

HP TRIM 6 Software Development Kit

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

The path and file name of the file to be


viewed

Stream

Unknown

For internal use only. In VB use the


reserved word "Nothing" as the value for
stream

Return Value
Type

Description

Boolean

Returns true if it is possible for the viewer to view the file

Page 118

HP TRIM 6 Software Development Kit

Copy
Copy Selection to the Clipboard.
Syntax
TRIMviewer.Copy ()

Page 119

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

DoMenu
Do not use.

Page 121

HP TRIM 6 Software Development Kit

EnableMenu
Do not use.

Page 122

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

The path and file name of the file to be


viewed

tempFile

Boolean

Indicates if the file is to be deleted once the


file is printed. Set this value to false if you
do not want the nominated file to be deleted
as part of this process.

stream

Unknown

For internal use only. In VB use the


reserved word "Nothing" as the value for
stream.

showDialogs

Boolean

Indicates if a print dialog (user interface) is


to be displayed prior to printing. Set this
value to true to display the dialog.

Page 124

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

The path and file name of the file to be viewed

tempFile

Boolean

Indicates if the file is to be deleted when it is no


longer viewed. Set this value to false if you do
not want the nominated file to be deleted as part
of this process.

Stream

Unknown

For internal use only. In VB use the reserved


word "Nothing" as the value for stream

launched

Boolean

Is a Return Value (so you must supply a variable


of type Boolean) see the Return Value table
(below) for its use

Return Value
Type

Description

Boolean

Returns true if the view was successful

launched

Returns true if the viewer could not display the file and so
launched the associated application

Page 126

HP TRIM 6 Software Development Kit

Events
Name

Description

View

Occurs when an object inside the file being viewed is


double clicked

Page 127

HP TRIM 6 Software Development Kit

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

The name of the embedded or contained file

deleteAfter

Boolean

True

Used to determine if the temporary file that is


the embedded or contained file is to be deleted
after this event. Set this to false if you do not
want the file to be deleted at the end of this
procedure.

handled

Boolean

False

Used to indicate if this event has been handled.


Setting this to True will indicate that the
TRIMviewer does not need to do anything at
the completion of this event. Setting this to
true will mean that the deleteAfter setting is
ignored.

Page 128

HP TRIM 6 Software Development Kit

Edit Box - TRIMedit


The TRIM Edit box is a combination control that is used through out HP TRIM. It
consits of a text area and a button know in TRIM 5 and 6 as a KwikSelect. It also
contains a calander for date selection as well as some common windows dialogs for
selecting a file or directory. The button can also be used to launch a spelling check
on the text in the text area of the control. It is a versatile control that can save a
sigificant amount of code writing.
More information on using the TRIMedit control
The following table indicates the Mode that the TRIMedit control is in along with a
picture of the control a description and any additional controls used in the selected
Mode.
Mode

Picture

Constituant Description
Controls

Browse

None

Fires the controls Browse


event that the
programmer can code to
(for example, the browse
event could contain code
to do a record lookup.
When the user has
selected a record the
records number can be
entered in the text area
of the control. The
selected records Uri can
be stored in the controls
Uri property).

Spell
Check

HP TRIM
Spell Check
Control

When the Spell Check


button is clicked the HP
TRIM Spell Check control
is launched and the text
in the control is checked
(for example, Great for a
notes field).

Select
Directory

Browse
Folder
Control

When the Folder button


is clicked a Browse Folder
control is displayed and
when a folder is selected
the full path to the
selected folder is entered
in the text area of the
control.

Input File

File Open
Control

When selected a File


Open dialog is displayed
to assist the user in
selecting an existing file

Page 129

HP TRIM 6 Software Development Kit

from the file system.


Output
File

Save As
Control

When selected a Save As


dialog is displayed. The
user can browse to the
desired directory and
enter the file name they
want to use. When save
is selected the full path
and file name are
entered in the text area
of the control.
! Note: this does not
save the file. The
programmer would
generally use the
BrowseSelected event if
they wanted to save a
file at this time.

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

Same as the Date and


Time description above.
The difference being
there is no area to store
the time value.

Format

None

Same as the Browse


mode where the
programmer must use
the Browse event to run
any functionality they
want when the button on
the TRIMedit control is
selected.

Page 130

HP TRIM 6 Software Development Kit

! Note: The BrowseSelected event is fired when control is returned to the


TRIMedit control from any constituent controls. This can be used by the
programmer to do any additional function/s required by the program (for
example, when using in Select Directory mode the programmer could validate if
the current user has appropriate permissions on the selected folder. Or when
using in Output File mode the programmer could attempt to save the file with
the user entered file name).

Page 131

HP TRIM 6 Software Development Kit

Constituent Controls
Name

Picture

Spell Check

File Open
Control

Page 132

HP TRIM 6 Software Development Kit

Save As
Control

Calendar
Control

Page 133

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

General

Name on Property page TRIMedit control


property

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

History Registry Key

HistoryKey

String

Numbers Only

Number

Boolean

Password

PassWord

Boolean

Border

Border

Boolean

Locked

Locked

Boolean

Multiline

MultiLine

Boolean

Want Return

WantReturn

Boolean

Page 136

HP TRIM 6 Software Development Kit

Verification

Name on Property page TRIMedit control


property

Type

Canned Date Mode

CannedDatesMode

ksCannedDatesMode

Allow Blank

AllowBlank

Boolean

Allow Blank Time

AllowBlankTime

Boolean

Allow Overwrite

AllowOverwrite

Boolean

Maximum Length

MaxLength

Long

Allow Create

AllowCreate

Boolean

Confirm Overwrite

ConfirmOverwrite

Boolean

Force Spell Check

ForceSpellCheck

Boolean

Page 137

HP TRIM 6 Software Development Kit

Fonts

Name on Property page TRIMedit control


property

Type

All fields on the Fonts


page

ifontDisp

Font

The fonts page is provided to assist the programmer in setting the attributes of the
font property.

Page 138

HP TRIM 6 Software Development Kit

Properties
Name

AllowBlank

Control Modes that use


this property

Description

All

Allow the text area of the


control to be blank

Date and Time

Allow the Time section of


the control when in Date
and Time mode to be blank

Select Directory, Output


File

Allows the creation of


directorys

Output File

Allows a file selected by


the user via the

All

Indicates if the control has


a boarder or appears flat

All

Returns/Sets the state (for


example,. Disabled of the
button on the control)

Date, Date and Time

Returns/Sets which if any


canned dates are
supported

All

Enables the Edit Undo


menu and function

AllowBlankTime

AllowCreate
AllowOverwrite
Border

BrowseState

CannedDatesMode

CanUndo

Windows Handle (HWnd)


to a static control that is
considered the caption for
this edit

CaptionWindow

All

Dependent on the state of


the AllowOverwrite
property, will prompt the
user to confirm a file
overwrite

All

Returns/Sets the index of


the item selected on the
dropdown list

All

Returns/sets the cursor


position in the text area of
the control as a number

Date, Date and Time

Returns/sets the Date or


DateTime

ConfirmOverwrite

CurSel

CursorPosition

DateTime

Page 139

HP TRIM 6 Software Development Kit

Returns/sets a value that


determines whether an
object can respond to
user-generated events.

Enabled

ExtraText

All

Returns/sets any extra text


for use in tool tips

All

Returns/sets any extra text


for use in tool tips when on
the list

Input File, Output File

String representing the file


types used by the Save As
or Open constituant
controls

All

The font used in the text


area of the control

Browse, Spell Check

Returns/Sets the value


that determines if a
spelling check must be
performed on the string in
the text area of the control

All

Returns/sets the number


of history items for the
control

All

Returns/sets the registry


key used when saving or
loading the history
collection

All

Returns/sets the maximum


number of history items
the control will store

All

Returns/Sets the number


of visible history rows

All

Returns/Sets whether the


History dropdown will
function even if the control
is locked

All

Returns the number of


non-history items in the
dropdown list

All

Returns/Sets an indicater
as to whether the text area

ExtraTextInList

FileFilter

Font

ForceSpellCheck

HistoryCount

HistoryKey

HistoryLimit

HistoryVisibleRows

HistoryWhenLocked

ItemCount

Locked

Page 140

HP TRIM 6 Software Development Kit

of the control is locked


All

Returns/Sets the
maximum length of text a
user can enter into the text
area of the control

All

Returns true if the value in


the text area of the control
has changed after loading
the control

All

Returns/Sets the switch


that determines if text in
the text area of the control
can span more than one
line

All

Returns/Sets the switch


that determines if numbers
are the only values the
user is allow to enter in the
text area of the control

All

Returns/Sets the switch


that determines if the
value in the text area will
be masked. Ignored if the
control is set to support
multiple lines

All

Indicates if scroll bars will


be displayed in the text
area of the control

N/A

Returns/Sets the mode of


the control

All

Returns/Sets a value that


determines if the text in
the text area of the control
gets selected when the
control gets focus

All

Returns/sets the value in


the text area of the control

All

Returns/sets the value


indicating if the control can
have a tool tip

All

Returns/Sets a TRIM Uri


value such as the Uri of a
record whose number is

MaxLength

Modified

MultiLine

Number

PassWord

ScrollBars

SelectMode

SelectOnFocus

Text

ToolTips

Uri

Page 141

HP TRIM 6 Software Development Kit

being displayed in the text


area of the control
All
Validated

Returns/sets the valid


state of the information in
the text area of the control

WantReturn

Allows (if true) the user to


insert carriage returns with
the ENTER key within a
multiline TRIMedit box

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

HP TRIM 6 Software Development Kit

AllowBlankTime
Allow the Time section of the control when in Date and Time mode to be blank.
Syntax
TRIMedit.AllowBlankTime = [Boolean]

Page 143

HP TRIM 6 Software Development Kit

AllowCreate
Enables the control to create a file system directory or folder when required.
Syntax
TRIMedit.AllowCreate = [Boolean]

Page 144

HP TRIM 6 Software Development Kit

AllowOverwrite
Enables the control to overwrite an existing file where required.
Syntax
TRIMedit.AllowOverwrite= [Boolean]

Page 145

HP TRIM 6 Software Development Kit

Border
Detirmines if the control will be displayed with a boarder (3D) or without (flat).
Syntax
TRIMedit.Border= [Boolean]

Page 146

HP TRIM 6 Software Development Kit

BrowseState
Returns/Sets the active state of the control.
Syntax
TRIMedit.BrowseState= [ksBrowseMode]

Page 147

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

CanUndo
Determines if the EditUndo method is able to be used.
Syntax
TRIMedit.CanUndo= [Boolean]

Page 149

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

CurSel
Returns/Sets the index of the item selected on the dropdown list,
Syntax
TRIMedit.CurSel= [Long ]

Page 152

HP TRIM 6 Software Development Kit

CursorPosition
Returns/Sets the current position of the cursor in the text area of the control.
Syntax
TRIMedit.CursorPosition= [Long]

Page 153

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Enabled
Returns/sets a value that determines whether an object can respond to usergenerated events.
Syntax
TRIMedit.Enabled= [Boolean]

Page 155

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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.

Note the semicolon

Example: "Documents (*.txt) (*.doc) (*.html)|*.txt;*.doc;*.html|"


Will add the line "Documents (*.txt) (*.doc) (*.html)" to the Files of Type area on
the "File Open Control" and the "Save As Control" and filter the file list area so that
only files with the extensions *.txt; *.doc or *.html will be displayed.
For multiple file type support using the more than one line:
"Description of the fileTypes|*.extension;*.extension|Description2 of the
fileTypes|*.extension2;*.extension2 |"" Note the pipe that seperates the
description from the file extensions is also used to separate a new line for use in the
Files of Type dropdown list on the relevant controls.
Example: "Documents (*.txt) (*.doc)|*.txt;*.doc|Web Documents (*.html)
(*.htm)|*.html;*.htm|"
Will add two lines to the Files of Type dropdown list
1.

"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

HP TRIM 6 Software Development Kit

Font
Returns/Sets the font used in the text area of the control.
Syntax
TRIMedit.Font = [stdole.IFontDisp]

Page 159

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

HistoryCount (Read Only)


Returns/Sets the count of the number of history items.
Syntax
TRIMedit.HistoryCount = [Long]

Page 161

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

ItemCount (Read Only)


Returns the number of non-history items in 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 HistoryVisibleRows property.
Syntax
TRIMedit.ItemCount = [Long]

Page 166

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

ScrollBars
Returns/Sets a value that determines which if any, scroll bars are displayed on the
control.
Syntax
TRIMedit.ScrollBars= [ksScrollMode]

Page 174

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

TabIndex
Returns/sets the tab order of an object within its parent form.
Syntax
TRIMedit.TabIndex= [Integer]

Page 177

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Validated
Returns/Sets a value that determines the validation state of the control.
Syntax
TRIMedit.Validated= [ksEditValidMode]

Page 183

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Methods
Name

Description

AddHistory

Adds an item to the history list

AddHistoryAt

Adds an item to the history list at a specified index

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

Adds an item to the dropdown list

AddItemAt

Adds an item to the dropdown list at a specified index

AddItemAtEx

Adds an item to the dropdown list including Uri and Exra


text at a specified index

AddItemEx

Adds an item to the dropdown list including Uri and Exra


text

EditCopy

Copies the selected text to the clipboard

EditCut

Copies the selected text value to the clipboard and sets the
selected text to a null string

EditDelete

Sets the text property to a null string

EditPaste

Copies the value in the clipboard to the text property

EditUndo

Undoes the last command performed in the text area

FindInList

Returns the index of the dropdown list item that contains


the specified text

FindUriInList

Returns the index of the dropdown list item that has the
specified Uri

GetListAt

Returns the text at the specified list index

GetSel

Returns the start and end positions of the selected text

GetUriAt

Returns the Uri of the dropdown list item that has the
specified index

LoadHistory

Loads any history items in the registry to the dropdown list


of the control

PressBrowse

Will do the same as if the user had pressed the kwikselect


themselves

RemoveHistory

Removes a history item at the specified index

Page 185

HP TRIM 6 Software Development Kit

RemoveItem

Removes a dropdown list item at the specified index

ReplaceSel

Replaces any the selected text with a specified value

ResetHistory

Clears the Histoy collection, removing all history items from


the registry

ResetItems

Clears any items from the dropdown list that are not history
items

SaveHistory

Saves the history items to the registry

SetIcons

Internal use only

SetSel

Selects text in the control based on the nominated start and


end positions

SetupContents

Sets up the contents of the control including text, extra text


and Uri plus, the valid and modified states

SpellCheck

Perform a spell check on the text in the control

Verify

Internal verification of the controls contents and firing of


the verify method

Page 186

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

The string to be added as a history item

Index

Long

The index at which to add the history


item

Page 188

HP TRIM 6 Software Development Kit

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

The string to be added as a history item

Index

Long

The index at which to add the history item

Uri

Variant

The unique record identifier of the object this


history item represents (for example, TRIM Record
Uri)

ExtraText String

Default Description

Any extra text you want displayed like a tool tip, if


the user has the mouse paused over this item (for
example, the TRIM Record Title)

Page 189

HP TRIM 6 Software Development Kit

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

The string to be added as a history item

Uri

Variant

The unique record identifier of the object this


history item represents (for example, TRIM Record
Uri)

ExtraText String

Default Description

Any extra text you want displayed like a tool tip, if


the user has the mouse paused over this item (for
example, the TRIM Record Title)

Page 190

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

The string to be added as an item to the


dropdown list

Index

Long

The index at which to add the item

Page 192

HP TRIM 6 Software Development Kit

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

The path and file name of the file to be viewed

Index

Long

The index at which to add the item

Uri

Variant

The unique record identifier of the object this


dropdown item represents (for example, TRIM
Record Uri)

ExtraText

String

Any extra text you want displayed like a tool tip,


if the user has the mouse paused over this item
(for example, the TRIM Record Title)

Page 193

HP TRIM 6 Software Development Kit

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

The path and file name of the file to be viewed

Uri

Variant

The unique record identifier of the object this


dropdown item represents (for example, TRIM
Record Uri)

ExtraText String

Default Description

Any extra text you want displayed like a tool tip, if


the user has the mouse paused over this item (for
example, the TRIM Record Title)

Page 194

HP TRIM 6 Software Development Kit

EditCopy
Copy the value of any selected text to the clipboard.
Syntax
TRIMedit.EditCopy ()

Page 195

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

EditDelete
Sets the value of the selected text to a null string.
Syntax
TRIMedit.EditDelete ()

Page 197

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

EditUndo
Undoes the last command performed in the text area. Depends on the CanUndo
property being set to True.
Syntax
TRIMedit.EditUndo ()

Page 199

HP TRIM 6 Software Development Kit

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

Returns index of the item in the list

Page 200

HP TRIM 6 Software Development Kit

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

Returns index of the item in the list

Page 201

HP TRIM 6 Software Development Kit

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

Value of the text in the dropdown list

Page 202

HP TRIM 6 Software Development Kit

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

Long Return Value

Number that specifies the start of


the selection in the string

EndChar

Long Return Value

Number that specifies the end of


the selection in the string

Page 203

HP TRIM 6 Software Development Kit

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

Uri of the specified row in the list

Page 204

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

Returns true on success

Page 207

HP TRIM 6 Software Development Kit

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

Returns true on success

Page 208

HP TRIM 6 Software Development Kit

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

The string that will replace the


current selection

CanUndo

Boolean

Enables the undo of this Action

Page 209

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

SaveHistory
Saves the control's current history items to the registry at the key specified in the
HistoryKey property.
Syntax
TRIMedit.SaveHistory ()

Page 212

HP TRIM 6 Software Development Kit

SetIcons
Internal use only.
Syntax
[Boolean] =TRIMedit.SetIcons (smallIcon, bigIcon)

Parameters
Name

Type

Default Description

smallIcon

For internal use only

bigIcon

For internal use only

Return Value
Type

Description

Boolean

For internal use only

Page 213

HP TRIM 6 Software Development Kit

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

Start selection position

endChar

Long

End Selection Position

Page 214

HP TRIM 6 Software Development Kit

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

Sets the value of the Text


property

ExtraText

String

Sets the value of the ExtraText


property

Uri

Variant

Sets the value of the Uri


property

Validated

ksEditValidMode

Sets the value of the Validated


property

Modified

Boolean

Sets the value of the Modified


property

Page 215

HP TRIM 6 Software Development Kit

SpellCheck
Runs the TRIM spelling checker against the contents of the text area.
Syntax
TRIMedit.SpellCheck ()

Page 216

HP TRIM 6 Software Development Kit

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

If an error occurs during this method this


parameter indicates if they are to be
displayed

forceVerify

Boolean

***UNDER CONSTRUCTION***

Return Value
Type

Description

Boolean

Returns true on success

Page 217

HP TRIM 6 Software Development Kit

Events
Name

Description

Browse

Occurs when the Kwick Select button is clicked

BrowseSelected

Occurs when control is returned to the the TRIMedit control


from a constituant control

Change

Occurs when the contents of the text area is changed

HistoryDelAllowed

Occurs if the controls Delete key (Del on some keyboards) is


pressed while the dropdown list is dowb and a an item
selected

HistoryDelDone

Occurs if the HistoryDelAllowed event has completed with a


result of deleting the list item

HistorySelected

Occurs when a history item is selected from the dropdown list

IdleTimeout

Occurs when user interaction on the control has not occurred


for a short period

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

Occurs when the user selects a different item from the


dropdown list

ValidChanged

Occurs when the value of the Validated property is changed

Verify

Occurs when the Verify method is called

Page 218

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

Determines if the history item is to be deleted


at the end of this event

Confirm

Boolean

True

Determines if the user should be prompted to


confirm the deletion of the history item

Index of the particular history item

Page 222

HP TRIM 6 Software Development Kit

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

The Uri of the list item that was removed. If no


Uri was set it will have a value of 0
The text that was displayed in the list item that
has been removed

Page 223

HP TRIM 6 Software Development Kit

HistorySelected
Occurs if an item on the dropdown list has been selected by the user.
Syntax
TRIMedit_HistorySelected ()

Page 224

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

SelChange
Occurs if a different item on the dropdownlist has been selected.
Syntax
TRIMedit_SelChange ()

Page 228

HP TRIM 6 Software Development Kit

ValidChanged
Occurs if the value of the controls Validated property has changed.
Syntax
TRIMedit_ValidChanged ()

Page 229

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Tree Box - TRIMtreeBox


The TRIMtreeBox control is used to display lists of items. In HP TRIM it is used to
display lists of records, locations and many other TRIM objects.
TRIMtreeBox listing records in the HP TRIM Demodb Database.

Page 231

HP TRIM 6 Software Development Kit

Sample Code

TRIMtreeBox list TRIM records example (Visual Basic)

TRIMtreeBox list TRIM records example (C#)

TRIMtreeBox Bouncing list example (Visual Basic)

Page 232

HP TRIM 6 Software Development Kit

TRIMtreeBox - List TRIM Records Visual Basic Example


The purpose of this code snippet is to demonstrate how with a minimum of effort a
list of TRIM objects can be displayed in a manner consistent with TRIM. A list that
can handle tree type behaviour along with sorting, tagging and icon display.
To use this code snippet you will need to:
1.

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.

Set the Tagging Mode property of the TRIMtreeBox to Enabled,


"TRIMtreeBox1.TaggingMade = tbtmTags".

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

Load any record

'/// 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

Procedural level variables (p_)


p_TRIMtreeRow
As TRIMOCXLib.TRIMtreeRow
p_Records
As TRIMSDK.Records
p_lngUriAr()
As Long
p_intUriCntr
As Integer

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

HP TRIM 6 Software Development Kit

'// Put the row uri into our array


p_lngUriAr(p_intUriCntr) = p_TRIMtreeRow.Uri
'// Get the next tagged row...
Set p_TRIMtreeRow = TRIMtreeBox1.GetNextRow
Loop
'//
'//
Set
'//

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

HP TRIM 6 Software Development Kit

TRIMtreeBox - List TRIM Records C# Example


The purpose of this code snippet is to demonstrate how with a minimum of effort a
list of TRIM objects can be displayed in a manner consistent with TRIM. A list that
can handle tree type behaviour along with sorting, tagging and icon display.
To use this code snippet you will need to:
1.

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.

Set the Tagging Mode property of the TRIMtreeBox to Enabled,


"TRIMtreeBox1.TaggingMade = tbtmTags".

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

// 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

HP TRIM 6 Software Development Kit

// Procedural level variables (p_)


string p_strUrisReturned;
bool p_blnRecordListExhausted;
// 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 (m_UrisReceived.GetLength(0) > 0)
{
m_RecordSearch.AddUrisClause(m_UrisReceived);
m_RecordSearch.Not();
m_RecordSearch.And();
}
// Use the GetTreeString to Add only a certain number of rows "MaximunRowsToReturn" to
the TRIMtreeBox
string txt = m_RecordSearch.GetRecords().GetTreeString (m_PropertyDefs,
false,
e.count,
out p_strUrisReturned,
out p_blnRecordListExhausted);
axTRIMtreeBox1.AddManyRows(txt);
// 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.
axTRIMtreeBox1.Full = p_blnRecordListExhausted;
// Reset the UriArray to those returned from the GetTreeString method
m_UrisReceived = null;
m_UrisReceived = p_strUrisReturned.Split(",".ToCharArray());
// If there are no more rows to get and there are none in the TRIMtreeBox then the
search did not return any records
if (axTRIMtreeBox1.Full && axTRIMtreeBox1.Count == 0)
{
axTRIMtreeBox1.Message = "No Records Found";
}
}

Page 240

HP TRIM 6 Software Development Kit

TRIMtreeBox - Bouncing List Visual Basic Example


The purpose of this code snippet is to demonstrate how to create a bouncing list.
That is a TRIMtreeBox control that only loads (gets from the Database) so many
records at a time returning to get more records when required. This is to return
control to the user as soon as the control has some records to display.
To use this code snippet you will need to:
1.

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.

Set the Scroll Bars property of the TRIMtreeBox to Both,


"TRIMtreeBox1.ScrollBars = ksBoth".

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

'/// 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

HP TRIM 6 Software Development Kit

m_UrisReceived = Split(p_strUrisReturned, ",")


'// If there are no more rows to get and there are none in the TRIMtreeBox then the
search did not return any records
If TRIMtreeBox1.Full And TRIMtreeBox1.Count = 0 Then
TRIMtreeBox1.Message = "No Records Found"
End If
End Sub

Page 244

HP TRIM 6 Software Development Kit

Properties
Name

Description

AllowExpandAll

Returns/Sets a value that determines all rows in the


control can be expanded

AllowSort

Returns/Sets a value that determines if the contents of


the control can be sorted

AnyTagged

Returns/Sets a value that indicates if any of the rows in


the control are tagged

ColumnCount

Returns/Sets the number of columns in the control

ColumnsLocked

Returns/Sets the lock state for the columns in the control

Count

Returns/Sets the number of rows in the control

CurrentRow

Returns/Sets the current (selected) row in the control

CurSel

Returns/Sets the index of the current (selected) row

DbId

Internal use Only

Font

The font used by the control when displaying text

Full

Returns/Sets a value that indicates that all result rows


have been added to the control

Heading

Returns/Sets a value that determines if the header row


(column names) are displayed

IdealHeight

Returns a number that when used as the height will


display all rows if possible

IdealWidth

Returns a number that when used as the width will


display columns with out hiding any information

Message

Returns/Sets a text message for the user

NumberTagged

Returns/Sets the number of tagged rows

PrefixPopup

Returns/Sets that determines if a Prefix dialog is


displayed when the user starts typing while this control
has focus

RegKey

Returns/Sets a registry key value used when saving or


loading a column state

RowHeight

Returns/Sets the height of the individual rows in the


control

ScrollBars

Returns/Sets a value that determines which if any scroll

Page 245

HP TRIM 6 Software Development Kit

bars will be displayed


SelectFirstRow

Returns/Sets a value that determines if the first row in


the control will be selected

ShowCurSel

Returns/Sets a value that determines if the selected row


will be highlighted

SnapLastColumn

Sizes the width of the last column to fit the available


space

TaggingMode

Returns/Sets a value that determines if any tagging is


allowed in the control

TagNewRows

Returns/Sets a value that determines if any new rows will


automatically be tagged when added to the control

ToolTips

Returns/Sets a value that determines if ToolTips are


active for this control

TopSel

Returns/sets a value that is the index of the row that is


currently displayed at the top of the control

Page 246

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

AnyTagged (Read Only)


Returns a value that indicates if any rows in the treebox have been tagged.
Syntax
[Boolean] = TRIMtreeBox.AnyTagged

Page 249

HP TRIM 6 Software Development Kit

ColumnCount (Read Only)


Returns a value that indicates the number of columns currently in the treebox.
Syntax
[Long] = TRIMtreeBox.ColumnCount

Page 250

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Count (Read Only)


Returns a value that indicates the number of rows in the treebox.
Syntax
[Long] = TRIMtreeBox.Count

Page 252

HP TRIM 6 Software Development Kit

CurrentRow (Read Only)

Returns the current selected row in the treebox.


Syntax
[TRIMtreeRow] = TRIMtreeBox.CurrentRow

Page 253

HP TRIM 6 Software Development Kit

CurSel
Returns the index of the currently selected row or sets the current selected row by
the index.
Syntax
TRIMtreeBox.CurSel = [Long]

Page 254

HP TRIM 6 Software Development Kit

DbId
For Internal use only.

Page 255

HP TRIM 6 Software Development Kit

Font
Returns/Sets the font used to display text in the treebox.
Syntax
TRIMtreeBox. Font = [stdole.IFontDisp]

Page 256

HP TRIM 6 Software Development Kit

Full
Returns/Sets a value that indicates if the treebox has loaded all of the available
rows.
Syntax
TRIMtreeBox. Full = [Boolean]

Page 257

HP TRIM 6 Software Development Kit

Heading
Returns/Sets a value that determines if the column heading is used.
Syntax
TRIMtreeBox.ColumnCount = [Boolean]

Page 258

HP TRIM 6 Software Development Kit

IdealHeight (Read Only)


Returns a value that indicates
***UNDER CONSTRUCTION***
Syntax
[Long] = TRIMtreeBox.Count

Page 259

HP TRIM 6 Software Development Kit

IdealWidth (Read Only)


Returns a value that if used, as the controls width will display all visible columns in
the treebox.
Syntax
[TRIMtreeRow] = TRIMtreeBox.CurrentRow

Page 260

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

NumberTagged (Read Only)


Returns a value that is the number of tagged rows.
Syntax
[Long] = TRIMtreeBox.NumberTagged

Page 262

HP TRIM 6 Software Development Kit

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]

The Prefix Popup Dialog:

Page 263

HP TRIM 6 Software Development Kit

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

The value of this property would be set to:


Software\My Cool Context SDK Appliction\TRIMtreeBox History

Page 264

HP TRIM 6 Software Development Kit

RowHeight (Read Only)


Returns the height of a single row to allow for sizing of the control so that no rows
will be cut off.
Syntax
[Long] = TRIMtreeBox.RowHeight

Page 265

HP TRIM 6 Software Development Kit

ScrollBars
Returns/Sets a value that determines if and which ScrollBars will be used by the
treebox control.
Syntax
TRIMtreeBox.ScrollBars= [ksScrollMode]

Page 266

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

TaggingMode
Returns/Sets a value that determines if tagging is allowed.
Syntax
TRIMtreeBox.TaggingMode = [tbTagMode]

Page 270

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

ToolTips
Returns/Sets a value that determines if tooltips will be active or not.
Syntax
TRIMtreeBox.ToolTips

= [Boolean]

Page 272

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Methods
Name

Description

AddColumn

Adds a column to the control

AddColumnEx

Adds a column to the control

AddManyColumns

Adds many columns to the control

AddManyRows

Adds many rows to the control

AddRow

Adds a row to the control

AddRowEx

Adds a row to the control

ClearColumns

Clears the control

ClearList

Clears the rows in the control

CollapseRow

Causes an expanded row to collapse

CustomizeColumns

Displays a dialog to enable some modification on the


columns

DeleteColumn

Removes a column from the control

DeleteRow

Removes a row from the control

ExpandRow

Display child rows

FindRow

Find a row based on entered criteria

FindRowEx

Find a row based on entered criteria

FindRowEx2

Find a row based on entered criteria

GetFirstColumn

Get the first column on the control

GetFirstRow

Get the first row on the control

GetNextColumn

Get the next column on the control

GetNextRow

Get the next row on the control

GetRow

Get a row based on its index

GetRowRect

Determine the bounding rectangle on the screen in pixels


for a particular row index in a tree box

InsertRow

Add a row to the control at a particular index

InsertRowEx

Add a row to the control at a particular index

LoadColumnState

Restore the column state based on information saved in the

Page 274

HP TRIM 6 Software Development Kit

registry
Move

Visual Basic Runtime-Only Extender method

SaveColumnState

Save the column state to the registry

SetFocus

Visual Basic Runtime-Only Extender method

ShowWhatsThis

Visual Basic Runtime-Only Extender method

SortColumn

Sort the rows based on a particular column

SwapRows

Swap the location of two rows in the control

TagAll

Tag or Untag all rows in the control

ZOrder

Visual Basic Runtime-Only Extender method

Page 275

HP TRIM 6 Software Development Kit

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

The caption to be displayed on the


column header if displayed

CharWidth

Long

The desired width of the column in


characters

Return Value
Type

Description

TRIMtreeCol

Returns a TRIMtreeCol object on which further refinements


can be made if desired

Page 276

HP TRIM 6 Software Development Kit

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

The caption to be displayed on the


column header if displayed

HeadingIcon

Variant

***UNDER CONSTRUCTION***

CharWidth

Long

The desired width of the column in


characters

Return Value
Type

Description

TRIMtreeCol

Returns a TRIMtreeCol object on which further refinements


can be made if desired

Page 277

HP TRIM 6 Software Development Kit

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

A string in the format specifed in the


Remarks area below

Return Value
Type

Description

Long

Returns the number of columns added

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

The propertyID that relates to the column

Caption

The caption for the column

Width

The width of the column in characters

VisibleState

1 = Visible, 2 = Invisible

IconID

Specifies the Icon to be displayed in the column header. Must


equate to one of the values specified in the TRIMIconId
enumeration defined in the HP TRIM ActiveX Controls library

Alignment

Specifies the alignment of the text within the column. Must


equate to one of the values specified in the tbAlignmentMode
enumeration defined in the HP TRIM ActiveX Controls library

DisplayMode

Specifies whether text and/or icons can be displayed in the


rows for this column. Must equate to on of the values
specified in the tbDisplayMode enumeration defined in the HP
TRIM ActiveX Controls library

IsDefault

1 = true, 0 = false. Only one column per A TRIMtreeBox

Page 278

HP TRIM 6 Software Development Kit

instance can be the default.


Example
The following example passed in as the Text parameter of this method identifies 4
columns:
1|Record Type|20|1|0|0|3|0;2|Record Number|30|1|0|0|4|1;3|Title|20|1|0|0|4|0;5|Date
Created|20|1|0|0|0|0;

Sample Code

Page 279

HP TRIM 6 Software Development Kit

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

A string in the format specifed in the


Remarks area below

Return Value
Type

Description

Long

Returns the number of rows added

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

HP TRIM 6 Software Development Kit

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

Returns a TRIMtreeRow object which was created as a result


of this method

Remarks
The string required by the Text parameter will be in the following format;
CellContents(IconID^Text)|CellContents|Etc

! Note: There must be as many CellContents as there are columns in the


TRIMtreeBox control. The Columns must be set up before any Rows are added.
CellContents format

For icon and text: IconID^Text

For Icon Only: IconID^

For Text Only: Text

See also:

AddManyRows

AddManyColumns

Page 281

HP TRIM 6 Software Development Kit

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

A string formatted as indicated in the Remarks


area of the AddRow method

Uri

Variant

A unique identifier for the item this row


represents, generally the Uri of the TRIM object
represented by this row

MayHaveKids Boolean

When set to true the row will be diaplayed with


a plus box indicating that it may be ably to
expand and display child rows

Id

When used with a TRIM object you can use this


property to store the type of TRIM object using
values from the enumeration:
btyBaseObjectTypes. It can also just be used to
store more unique identification for the item this
row represents

Long

Return Value
Type

Description

TRIMtreeRow

Returns the TRIMtreeRow object set up by this method

Page 282

HP TRIM 6 Software Development Kit

ClearColumns
Clears the the TRIMtreeBox control. Columns and as a result any existing rows get
cleared by this method.
Syntax
TRIMtreeBox.ClearColumns ()

Page 283

HP TRIM 6 Software Development Kit

ClearList
Clears any rows from the control. Columns are left intact by this method.
Syntax
TRIMtreeBox. ClearList ()

Page 284

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

Index of the row in the TRIMtreeBox to be


expanded

recursive

Boolean

Switch that determines if child rows are to be


expanded also

Page 289

HP TRIM 6 Software Development Kit

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

The string to search for in the text


area of the nominated column

LookInCol

Variant

The Column in which to search

CaseSensitive Boolean

Determines if the search is to be


case sensitive or not

PrefixSearch

Boolean

Determines if an exact match must


be made or if the results only have
to start with the nominated search
string

VisibleOnly

Boolean

Determines if visable rows only are


part of the search or if child rows
that have been loaded (expanded
once) but are currently collapsed
are also searched.

FoundInRow

Long Return Value

The index of the first row found


that matches the search criteria. If
no match is found the value will be
set to 1.

FoundInColIdx Long Return Value

The index of the column in which


the match was made. If no match
is found the value will be set to 1.

Return Value
Type

Description

TRIMtreeRow

Returns the first TRIMtreeRow object which matched the


search criteria

Page 290

HP TRIM 6 Software Development Kit

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

The Uri to search for in the Uri property of the


TRIMtreeRows

AnId

Long

TRIMtreeRow.Id property criteria for the search.


A zero value is ignored, so pass in 0 for this
parameter if you want to search only on the Uri

FoundInRow Long

Default Description

The index of the first row found that matches the


search criteria. If no match is found the value will
be set to 1.

Return Value
Type

Description

TRIMtreeRow

The first TRIMtreeRow object that matched the search


criteria

Page 291

HP TRIM 6 Software Development Kit

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

The Uri to search for in the Uri


property of the TRIMtreeRows

AnId

Long

TRIMtreeRow.Id property criteria


for the search. A zero value is
ignored, so pass in 0 for this
paramater if you want to search
only on the Uri

FoundInRow

Long Return Value

The index of the first row found


that matches the search criteria.
If no match is found the value will
be set to 1.

StartFromIndex Long

Default Description

The row index on which to start


the search

Return Value
Type

Description

TRIMtreeRow

The first TRIMtreeRow object which matched the search


criteria

Page 292

HP TRIM 6 Software Development Kit

GetFirstColumn
Returns the first column starting from on the left side of the TRIMtreeBox control.
Syntax
[TRIMtreeCol] = TRIMtreeBox.GetFirstColumn ()

Return Value
Type

Description

TRIMtreeCol

The first TRIMtreeCol object

See also:

GetNextColumn

Page 293

HP TRIM 6 Software Development Kit

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

Determines if the iteration will return just tagged


rows or all rows

Reserved

Reserved for future use, set to False

Boolean

Return Value
Type

Description

TRIMtreeRow

The first TRIMtreeRow object

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

HP TRIM 6 Software Development Kit

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

The next TRIMtreeCol object

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

HP TRIM 6 Software Development Kit

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

Returns the TRIMtreeRow object set up by this method

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

The index of the row the rectangle is


required for

Left

Long Return Value

The left hand side of the rectangle

Top

Long Return Value

The top of the rectangle

Right

Long Return Value

The right side of the rectangle

Bottom

Long Return Value

The bottom of the rectangle

Return Value
Type

Description

Long

***UNDER CONSTRUCTION***

Page 298

HP TRIM 6 Software Development Kit

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

The index on the TRIMtreeBox that the row is to be


inserted

Text

String

A String in the format specified in the remarks below


containing data to use in the creation of the row

Return Value
Type

Description

TRIMtreeRow

The TRIMtreeRow object created

Remarks
The string required in the Text parameter needs to be in the following format;
CellContents(IconID^Text)|CellContents|Etc

! Note: There must be as many CellContents as there are columns in the


TRIMtreeBox control. The Columns must be set up before any Rows are added.
CellContents format

For icon and text: IconID^Text

For Icon Only: IconID^

For Text Only: Text

See also:

InsertRowEx

Page 299

HP TRIM 6 Software Development Kit

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

The index on the TRIMtreeBox that the row is to


be inserted

Text

String

The data used in the creation of the row. The


required format for this paramater can be seen
in the Remarks area of the InsertRow method

Uri

Variant

The Uri to set as the Uri property for this row

MayHaveKids Boolean

Determines if a plus "+" box is to be displayed


against this row that indicates the row may have
child rows

Id

Long

The value that is set as the Id property of the


row

Reserved

Boolean

Reserved for future use. Set this value to False

Return Value
Type

Description

TRIMtreeRow

The TRIMtreeRow object created

Page 300

HP TRIM 6 Software Development Kit

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

Indicates if the method was successful

Remarks
Columns must be added to the control before calling this method.

Page 301

HP TRIM 6 Software Development Kit

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

Indicates if the method was successful

Remarks
A possible reason for this method to fail might be inadequate permissions to the
system registry current user area.

Page 302

HP TRIM 6 Software Development Kit

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

The column to sort by specified by either


index or TRIMtreeCol object

Ascending

Boolean

Determines the direction of the sort

SortCurrentRows Boolean

Default Description

***UNDER CONSTRUCTION***

Page 303

HP TRIM 6 Software Development Kit

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

Index of one of the rows to be swapped

Index2

Long

Index of the other row to be swapped

Remarks
To avoid concusion and unexpected results, ensure that the rows are collapsed
before using this method.

Page 304

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Events
Name

Description

AboutToExpand

Occurs if the row should be expanded

AboutToSort

Occurs if a sort is about to be carried out

BreakTriggered

Occurs if user pressed 'Break' key whilst doing a sort.

ColMadeVisible

Occurs if a column has been added to the active list

ContextMenu

Occurs if the Windows context menu event occurs

DelKeyPressed

Occurs if the Delete key has been pressed

FileDropped

***UNDER CONSTRUCTION***

LButtonClick

Occurs if the left mouse button is clicked

LButtonDblClick

Occurs if the left mouse button is double clicked

MenuItemEnable

For Internal Use Only

MenuItemSelected

For Internal Use Only

OLEDragDrop

***UNDER CONSTRUCTION***

OLEDragOver

***UNDER CONSTRUCTION***

OLEStartDrag

***UNDER CONSTRUCTION***

PrefixOkForColumn

Occurs just before the popup dialog appears.

PrefixOutOfRange

Occurs if prefix was out of range and opted to reselect.

RButtonClick

Occurs if the right mouse button is clicked

RButtonDblClick

Occurs if the right mouse button is double clicked

RoomForRows

Occurs if the control is not "Full" and there is space for


more rows

SelectionChanged

Occurs if the selected row changes

SortCompare

***UNDER CONSTRUCTION***

TagChanged

Occurs if the tagged state of a row changes

TimerTriggered

***UNDER CONSTRUCTION***

TopSelChanged

Occurs if the top most visible row changes

Page 306

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

The column on which the sort is based

ascending

Boolean

Indicates the direction of the sort

SortCurrentRows Boolean

***UNDER CONSTRUCTION***

Allow

Indicates if the sort is to go ahead

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

HP TRIM 6 Software Development Kit

BreakTriggered
Occurs if the user pressed the 'Break' key whilst doing a sort.
Syntax
TRIMtreeBox_ BreakTriggered ()

Page 309

HP TRIM 6 Software Development Kit

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

The column about to be made visable

CellNumber

Long

The cell number of the column

Page 310

HP TRIM 6 Software Development Kit

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

The row on which the event occurred

WithMouse

Boolean

Indicates that the event occurred using the


mouse

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

The column on which the prefix search is


being carried out

PrefixOK

Boolean

Determines if the Prefix Search dialog


should be allowed to appear

PrefixReselectOK Boolean

Default Description

Determines if the user may reselect a


prefix if the one they have given is out
of range.

Remarks
This event can be used to enable the appropriate behavour depending on the current
sort column.

Page 321

HP TRIM 6 Software Development Kit

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

The column on which the reselected prefix


search is being carried out

Prefix

String

The new prefix to search by

Page 322

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

SelectionChanged
Occurs if a different row is selected.
Syntax
TRIMtreeBox_SelectionChanged ()

Page 326

HP TRIM 6 Software Development Kit

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

Column to perform sort on

RowA

TRIMtreeRow

A nominated row to compare with RowB

RowB

TRIMtreeRow

A nominated row to compare with RowA

AlessThanB Boolean

Default Description

Determines the sort order of the two


specified rows. Should be set to true if
rowA < rowB.

Page 327

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Other Objects Used by the ActiveX Controls


The TRIMOXCLib containes objects other than the activeX controls. These objects
are used by the activeX controls.
Name

Used By

TRIMdateTime

TRIMedit

TRIMfavorites

Reserved

TRIMtreeCol

TRIMtreeBox

TRIMtreeRow

TRIMtreeBox

Page 331

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Properties
Name

``

CannedDate

Returns/Sets a canned date

Date

***UNDER CONSTRUCTION***

DateHi

***UNDER CONSTRUCTION***

IgnoreDate

Returns/Sets the control to ignore the date component of a


date time

IgnoreTime

Returns/Sets the control to ignore the Time component of


a date time

Page 333

HP TRIM 6 Software Development Kit

CannedDate
Returns/Sets the canned date value of the TRIMdateTime.
Syntax
TRIMdateTime.CannedDate= [dtCannedDate]

Page 334

HP TRIM 6 Software Development Kit

Date
Returns/Sets the date value of the TRIMdateTime.
Syntax
TRIMdateTime.Date = [Date]

Page 335

HP TRIM 6 Software Development Kit

DateHi
Returns/Sets.
***UNDER CONSTRUCTION***
Syntax
TRIMdateTime.DateHi = [Date]

Page 336

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

TRIMfavorites
Reserved. This object class is not currently in use.

Page 339

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Properties
Name

``

Alignment

The alignment of text in this column

Caption

The text to display in the header

CharWidth

The width of the column in characters

DisplayMode

Returns/Sets what gets displayed in this column

Ellipsis

Returns/Sets a value that determines if ellipsis are displayed if


the text in this column does not fit in the size

Id

Returns the identifier for this column

Index

Returns the index of the column

IsDefault

Returns/Sets the default status for the column

Sizeable

Returns/Sets a value that determines if the columns width can


be customized

SortMode

Returns/Sets the type of sort to perform on this column

SortState

Returns/Sets the direction a sort is carried out in

Visible

Returns/Sets the visible state for this column

VisibleMode

Returns/Sets a value that determines if the user can see or


remove a column

Width

Returns/Sets the width in pixels

Page 341

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

CharWidth
Returns/Sets the width of the column in characters.
Syntax
TRIMtreeCol.CharWidth = [Long]

Page 344

HP TRIM 6 Software Development Kit

DisplayMode
Returns/Sets a value that determines if the column will display Icons, Text or both.
Syntax
TRIMtreeCol.DisplayMode = [tbDisplayMode]

Page 345

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Index (Read Only)


Returns a value that is the current index for the column.
Syntax
[Long] = TRIMtreeCol. Index

Page 348

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Sizeable
Returns/Sets a value that determines if the columns width can be customized at
runtime.
Syntax
TRIMtreeCol.Alignment = [tbAlignmentMode]

Page 350

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Visible
Returns/Sets a value that determines if the column is displayed.
Syntax
TRIMtreeCol.Visible = [Boolean]

Page 353

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Width (Read Only)


Returns a value that is the columns width in pixels.
Syntax
TRIMtreeCol.Width = [Long]

Page 355

HP TRIM 6 Software Development Kit

Methods
Name

``

SetIcon

Sets the icon to use in this column

Page 356

HP TRIM 6 Software Development Kit

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

Returns the success of the method

Page 357

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Properties
Name

``

AutoRedraw

Returns/Sets a value that determines if auto redrewar is


enabled

Bold

Returns/Sets a value that determines if the font appears


bold in the row

Enabled

Returns/Sets a value that determines if the row is enabled

EverExpanded

Returns a value that indicates if the row has ever been


expanded

Expanded

Returns a value that indicates if the row is currently


expanded

ExpandLocked

Returns/Sets a value that determines if the row can be


expanded or collapsed

Id

Returns/Sets an identifier value on the row

Index

Returns a value that indicates the position in the list

MayHaveKids

Returns/Sets a value that indicates that the row may be a


parent row

RowText

Returns/Sets a specially formatted string that gets or sets


the icon and test values of the cells

Tagged

Returns/Sets the tagged state of the row

TagStateLocked

Returns/Sets a boolean that determines if a user can tag


or untag a row through the user interface

Uri

Returns/Sets a unique identifier

Visible

Returns/Sets the visible state of the row

Page 359

HP TRIM 6 Software Development Kit

AutoRedraw
Returns/Sets a value that determines if auto redrewar is enabled.
Syntax
TRIMtreeRow.AutoRedraw = [Boolean]

Page 360

HP TRIM 6 Software Development Kit

Bold
Returns/Sets a value that determines if the font appears bold in the row.
Syntax
TRIMtreeRow.Bold = [Boolean]

Page 361

HP TRIM 6 Software Development Kit

Enabled
Returns/Sets a value that determines if the row is enabled.
Syntax
TRIMtreeRow.Enabled = [Boolean]

Page 362

HP TRIM 6 Software Development Kit

EverExpanded (Read Only)


Returns a value that indicates if the row has ever been expanded.
Syntax
TRIMtreeRow.EverExpanded = [Boolean]

Page 363

HP TRIM 6 Software Development Kit

Expanded (Read Only)


Returns a value that indicates if the row is currently expanded.
Syntax
TRIMtreeRow.Expanded = [Boolean]

Page 364

HP TRIM 6 Software Development Kit

ExpandLocked
Returns/Sets a value that determines if the row can be expanded or collapsed.
Syntax
TRIMtreeRow. ExpandLocked = [Boolean]

Page 365

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Index (Read Only)


Returns a value that indicates the position in the list. This will change for a given
row if rows are inserted above or a sort is carried out.
Syntax
TRIMtreeRow.Index = [Long]

Page 367

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Tagged
Returns/Sets the tagged state of the row.
Syntax
TRIMtreeRow.Tagged = [Boolean]

Page 370

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

Visible
Returns/Sets the visible state of the row.
Syntax
TRIMtreeRow.Visible = [Boolean]

Page 373

HP TRIM 6 Software Development Kit

Methods
Name

``

AddChild

Adds a child row to this TRIMtreeRow

AddManyRows

Adds many child rows to this TRIMtreeRow

ClearChildren

Removes any child rows to this TRIMtreeRow

CollapseRow

Collapses this row in the user interface

DeleteChildRow

Removes a particular child row

ExpandRow

Expands this row in the user interface

GetCellText

Gets the text in a particular cell of this TRIMtreeRow

GetFirstRow

Gets the first child row of this TRIMtreeRow

GetNextRow

Gets the next child row of this TRIMtreeRow

GetParentRow

Gets the parent row of this TRIMtreeRow

InsertChild

Adds a child row at a specified index

SetCellIcon

Sets the icon to be used in this cell of the


TRIMtreeRow

SetCellText

Sets the text value of this cell of the TRIMtreeRow

Page 374

HP TRIM 6 Software Development Kit

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

A string in the format described in the remarks


section of the AddRow method

Uri

Variant

The unique identifier for the row

MayHaveKids Boolean

When set to true the row will be displayed with a


plus box indicating that it may be able to expand
and display child rows

Id

When used with a TRIM object you can use this


property to store the type of TRIM object using
values from the enumeration:
btyBaseObjectTypes. It can also just be used to
store more unique identification for the item this
row represents.

Long

Return Value
Type

Description

TRIMtreeRow

Returns the row object added as a child to the TRIMtreeRow

See also:

AddManyRows

Page 375

HP TRIM 6 Software Development Kit

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

A string in the format specifed in the


Remarks area below

Return Value
Type

Description

Long

Returns the number of rows added

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

HP TRIM 6 Software Development Kit

ClearChildren
Removes any child rows from the TRIMtreeRow.
Syntax
TRIMtreeRow.ClearChildren ()

Page 377

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

Both the column index or a TRIMtreeCol


object are accepted

Return Value
Type

Description

String

The value in the specified cell of the TRIMtreeRow

Page 381

HP TRIM 6 Software Development Kit

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

Sets the TRIMtreeRow child row iteration


to include all or only tagged rows

Return Value
Type

Description

TRIMtreeRow

The first row found in the child row iteration

Page 382

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

GetParentRow
Returns the parent row of this TRIMtreeRow.
Syntax
[TRIMtreeRow] = TRIMtreeRow. GetParentRow ()

Return Value
Type

Description

TRIMtreeRow

The parent TRIMtreeRow. If there is no parent to this row the


returned TRIMtreeRow will be set to Nothing.

Page 384

HP TRIM 6 Software Development Kit

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

The location in the child rows to insert the new


row

Text

String

A string in the format described in the remarks


section of the AddRow method

Uri

Variant

A unique identifier for the item this row


represents, generally the Uri of the TRIM object
represented by this row

MayHaveKids Boolean

When set to true the row will be diaplayed with


a plus box indicating that it may be ably to
expand and display child rows

Id

When used with a TRIM object you can use this


property to store the type of TRIM object using
values from the enumeration:
btyBaseObjectTypes. It can also just be used to
store more unique identification for the item this
row represents

Long

Return Value
Type

Description

TRIMtreeRow

The row iserted

Page 385

HP TRIM 6 Software Development Kit

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

Both the column index or a TRIMtreeCol object are


accepted

Icon

Both a number representing a value in the TRIMIconId


enumeration or a string that is a file extention known
to the machine are accepted

Variant

Return Value
Type

Description

Boolean

Returns the success of the method

Page 386

HP TRIM 6 Software Development Kit

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

Both the column index or a TRIMtreeCol object are


accepted

Text

String

The value of the text to be displayed in the specified


cell

Return Value
Type

Description

Boolean

Returns the success of the method

Page 387

HP TRIM 6 Software Development Kit

Enumerated Types for ActiveX Controls


Name

Description

dtCannedDate

TRIM Canned Dates

fvFavoriteType

Favorite types

ksBrowseMode

Browse Active Modes for a HP TRIM Edit Box

ksCannedDatesMode Canned Date Modes for the contents of a HP TRIM Edit Box
ksEditValidMode

Validity Modes for the contents of a HP TRIM Edit Box

ksScrollMode

Scroll Bar Modes for HP TRIM Controls

ksSelectMode

Select Modes for a HP TRIM Edit Box

tagTRIMIconId

HP TRIM Icon IDs

tbAlignmentMode

Text Alignment Modes for HP TRIM Tree Column

tbDisplayMode

Display mode for HP TRIM Tree Column

tbEllipsisMode

Text Ellipsis Modes for HP TRIM Tree Column

tbSortMode

Sort Mode for HP TRIM Tree Column

tbSortState

Sort State for HP TRIM Tree Column

tbTagMode

Tagging Mode for HP TRIM Tree Box

tbVisibleMode

Visible Permission status for a HP TRIM Tree Box Column

TRIMIconId

HP TRIM Icon IDs

vwDocFormat

Document Format Categories displayed in a HP TRIM Viewe

Page 388

HP TRIM 6 Software Development Kit

dtCannedDate
Name

Value

Description

cd_none

None

cd_yesterday

Yesterdays date

cd_today

PrivateTodays date

cd_tomorrow

Tomorrows date

cd_lastWeek

The date range for last week

cd_thisWeek

The date range for this week

cd_nextWeek

The date range for next week

cd_lastMonth

The date range for last month

cd_thisMonth

The date range forthis month

cd_nextMonth

The date range fornext month

cd_this year

10

The date range forthis year

cd_yearToDate

11

The date range for the year to today

12

The date range that is the last seven


days

13

The date range that is the next seven


days

14

The date range that is the last 14 days

cd_last7Days
cd_next7Days
cd_last14Days

Page 389

HP TRIM 6 Software Development Kit

fvFavoriteType
Name
fvNormal
fvWorktray
fvRecentDocuments
fvRecentFolders

Value

Description

The appropriate favourite tray for the


object type

Users worktray, records are manually


added and removed from this tray

Tray containing any recient documents


(records with electronic attachments)

Tray containing any recient folders (Records


with contained records)

Page 390

HP TRIM 6 Software Development Kit

ksBrowseMode
Name

Value

Description

ksBrowseDisabled

Disabled

ksBrowseActive

Active

ksBrowseEvenLocked 2

Browse active even when locked

Page 391

HP TRIM 6 Software Development Kit

ksCannedDatesMode
Name

Value

Description

cdNone

No Canned dates

cdAll

All canned dates available for selection

All canned dates available for selection


except date ranges

Only future canned dates available for


selection

Only future canned dates available for


selection excluding date ranges

cdNoRanges
cdOnlyFuture
cdOnlyFutureNoRanges

Page 392

HP TRIM 6 Software Development Kit

ksEditValidMode
Name

Value

Description

ksUnknown

-1

Unknown

ksNotValidated

Invalid

ksValid

Valid

ksAmbiguous

Ambiguous

Page 393

HP TRIM 6 Software Development Kit

ksScrollMode
Name

Value

Description

ksNone

No Scroll bars

ksHoriz

Horizontal scroll bar

ksVert

Vertical scroll bar

ksBoth

Both horizontal and vertical scroll bars

Page 394

HP TRIM 6 Software Development Kit

ksSelectMode
Name

Value

Description

Browse mode, (Kwick select icon, user defined


function)

ksSpell

Invoke Spell Check

ksDir

Browse for directory (Select directory)

ksFileIn

Browse for input file (Select file)

Browse for output file (Select directory and enter


file name or select an existing file)

ksDateTime

Date and Time mode (Includes calander control)

KsDate

Date mode (Includes calander control)

Format mode (ellipsis icon, user defined


function)

ksBrowse

ksFileOut

KsFormat

Page 395

HP TRIM 6 Software Development Kit

tbAlignmentMode
Name

Value

Description

tbaLeft

Align Left

tbaRight

Align Right

tbaCenter

Align Centre

Page 396

HP TRIM 6 Software Development Kit

tbDisplayMode
Name

Value

Description

tbdmTextOnly

Display text only

tbdmIconOnly

Display the icon only

tbdmText

Display text

tbdmIcon

Display icon

tbdmBoth

Display both the text and icon

Page 397

HP TRIM 6 Software Development Kit

tbEllipsisMode
Name

Value

Description

tbeNone

No ellipsis

Ellipsis displayed to the right of the text when it


does not fit in the display area

tbeRight

Page 398

HP TRIM 6 Software Development Kit

ltbSortMode
Name

Value Description

tbsmNone

No sort mode

tbsmAlphaNoCase

Sort alphabetically ignore case

tbsmAlphaCase

Sort alphabetically case sensitive

tbsmNumeric

Sort numerically

tbsmIcon

Sort by icon

Causes the SortCompare Event to fire on


the TRIMtreeBox control

tbsmDate

Sort by Date

tbsmTime

Sort by Time

tbsmDateTime

Sort by Date and Time

tbsmFileSize

Sort by file size

10

Sort alphabetically case sensitive with


enhanced numbers

11

Sort alphabetically ignore case with


enhanced numbers

12

Sort by Currency

tbsmOwnerEvent

tbsmAlphaNoCaseEnhanced
tbsmAlphaCaseEnhanced
tbsmCurrency

Page 399

HP TRIM 6 Software Development Kit

tbSortState
Name

Value

Description

tbssUnsorted

Unsorted

tbssAscending

Sort Ascending

tbssDescending

Sort Descending

Page 400

HP TRIM 6 Software Development Kit

tbTagMode
Name

Value

Description

tbtmDisabled

Tagging disabled

tbtmTags

Tagging enabled

Page 401

HP TRIM 6 Software Development Kit

tbVisibleMode
Name

Value

Description

Can be hidden or visable (users


descretion)

tbvHidden

Must be hidden

tbvMandatory

Must be visable

tbvEither

Page 402

HP TRIM 6 Software Development Kit

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_

Record Type icon

icon_act

Action icon

icon_prc

Procedure icon

icon_odma_

Icons used in the ODMA (Desktop applications)


integration

icon_loc

Location icons

icon_loceadd

Location electronic address icons

icon_login

Location login type icons

icon_rec_in_

Record current location options icons

icon_wkc_doc

Workflow document icons

icon_edm..

Electronic document management icons

icon_sch..

Retention Schedule icons

icon_th

Thesaurus icons

Name

Value

Description

icon_tower

The TOWER icon

icon_topdrawer

The TopDrawer icon

icon_trf

TRIM Reference icon

icon_viewer

TRIM Viewer icon

icon_tick

450

Tick icon

icon_cross

451

Cross icon

icon_noentry

454

Not Allowed icon

icon_rty_yellowfile

502

Record Type Folder icon

Page 403

HP TRIM 6 Software Development Kit

icon_rty_yellowdoc

503

Record Type Document icon

icon_rty_yellowbox

504

Record Type Box icon

icon_rty_yellowbook

505

Record Type Book icon

icon_rty_whitefile

506

Record Type Folder icon

icon_rty_whitedoc

507

Record Type Document icon

icon_rty_whitebox

508

Record Type Box icon

icon_rty_whitebook

509

Record Type Book icon

icon_rty_greenfile

510

Record Type Folder icon

icon_rty_greendoc

511

Record Type Document icon

icon_rty_greenbox

512

Record Type Box icon

icon_rty_greenbook

513

Record Type Book icon

icon_rty_ltbluefile

514

Record Type Folder icon

icon_rty_ltbluedoc

515

Record Type Document icon

icon_rty_ltbluebox

516

Record Type Box icon

icon_rty_ltbluebook

517

Record Type Book icon

icon_rty_dkbluefile

518

Record Type Folder icon

icon_rty_dkbluedoc

519

Record Type Document icon

icon_rty_dkbluebox

520

Record Type Box icon

icon_rty_dkbluebook

521

Record Type Book icon

icon_rty_blackfile

522

Record Type Folder icon

icon_rty_blackdoc

523

Record Type Document icon

icon_rty_blackbox

524

Record Type Box icon

icon_rty_blackbook

525

Record Type Book icon

icon_rty_redfile

526

Record Type Folder icon

icon_actdone

527

Action Done icon

icon_rty_reddoc

527

Record Type Document icon

icon_rty_redbox

528

Record Type Box icon

icon_rty_redbook

529

Record Type Book icon

Page 404

HP TRIM 6 Software Development Kit

icon_rty_greyfile

530

Record Type Folder icon

icon_rty_greydoc

531

Record Type Document icon

icon_rty_greybox

532

Record Type Box icon

icon_rty_greybook

533

Record Type Book icon

icon_rty_pinkfile

534

Record Type Folder icon

icon_rty_pinkdoc

535

Record Type Document icon

icon_rty_pinkbox

536

Record Type Box icon

icon_rty_pinkbook

537

Record Type Book icon

icon_rty_tealfile

538

Record Type Folder icon

icon_rty_tealdoc

539

Record Type Document icon

icon_rty_tealbox

540

Record Type Box icon

icon_rty_tealbook

541

Record Type Book icon

icon_rty_envopen

542

Record Type Open Envelope icon

icon_rty_envclosed

543

Record Type Closed Envelope icon

icon_rty_cd

544

Record Type CD icon

icon_rty_clipboard

545

Record Type Clipboard icon

icon_rty_tape1

546

Record Type Tape icon

icon_rty_tape2

547

Record Type Tape icon

icon_rty_floppy3

548

Record Type Floppy Disk icon

icon_rty_floppy5

549

Record Type Floppy Disk icon

icon_rty_orangefile

550

Record Type Folder icon

icon_rty_orangedoc

551

Record Type Document icon

icon_rty_orangebox

552

Record Type Box icon

icon_rty_orangebook

553

Record Type Book icon

icon_rty_brownfile

554

Record Type Folder icon

icon_rty_browndoc

555

Record Type Document icon

icon_rty_brownbox

556

Record Type Box icon

icon_rty_brownbook

557

Record Type Book icon

Page 405

HP TRIM 6 Software Development Kit

icon_act

570

Action icon #1

icon_action

571

Action icon #2

icon_actdue

573

Action Due icon

icon_actnormal

574

Action Normal icon

icon_actoverdue

575

Action Overdue icon

icon_prcdone

576

Procedure Done icon

icon_prcdue

577

Procedure Due icon

icon_prcnormal

578

Procedure Normal icon

icon_prcoverdue

579

Procedure Overdue icon

icon_procedure

580

Procedure icon

icon_census

585

Census icon

icon_Caveat

590

Security Caveat icon

icon_extrafields

591

Extra Fields icon

icon_lookupsets

592

Lookup Sets icon

icon_securitylevel

593

Security Level icon

icon_webLayouts

594

Web Publisher Layouts icon

icon_searchmethod

600

Search Methods icon

icon_odma_draft

605

ODMA Draft icon

icon_odma_modified

606

ODMA Modified icon

icon_odma_readonly

607

ODMA Read Only icon

icon_odma_unknown

608

ODMA Unknown icon

icon_odma_unmodified

609

ODMA Original icon

icon_class_inactive

615

Class Inactive icon

icon_plannotok

616

icon_fpplans

617

Classification Plan icon

icon_activeloc

620

Location Active icon

icon_localllist

621

Location List icon

icon_contact

622

Contact icon

Page 406

HP TRIM 6 Software Development Kit

icon_loccontactlist

623

Location Contact List icon

icon_locdirectory

624

Internal Directory icon

icon_loceaddrimage

625

Location Address Image icon

icon_loceaddrmail

626

Location Address Mail icon

icon_loceaddrrdn

627

icon_loceaddrurl

628

Location Address URL icon

icon_externalloc

629

Location Extrenal icon

icon_locextlist

630

Location External List icon

icon_extposition

631

External Position icon

icon_group

632

Group icon

icon_groupadhoc

633

Adhoc Group icon

icon_locgroupslist

634

Location Groups List icon

icon_inactiveloc

635

Location Inactive icon

icon_internalloc

636

Location Internal icon

icon_locintlist

637

Location Internal List icon

icon_loginadmin

638

Administration Login icon

icon_logincustom

639

Custom Login icon

icon_logindisabled

640

Disabled Login icon

icon_loginenduser

641

End User Login icon

icon_loginenquiry

642

Enquiry User icon

icon_loginexpired

643

Expired Login icon

icon_loginmanager

644

Information Manager Login icon

icon_loginnone

645

No Login icon

icon_loginworker

646

Information Worker Login icon

icon_org

647

Organization icon

icon_locorglist

648

Local Organization icon

icon_person

649

Person icon

icon_position

650

Position icon

Page 407

HP TRIM 6 Software Development Kit

icon_locposlist

651

Local Position List icon

icon_postalCode

652

Postal Code icon

icon_locstafflist

653

Local Staff List icon

icon_unit

654

Unit icon

icon_locunitlist

655

Location Unit List icon

icon_unknownloc

656

Location Unknown icon

icon_locunknownlist

657

Location Unknown List icon

icon_rec_at_home

660

Record at Home icon

icon_duetray

661

Due Tray icon

icon_edmdocavailable

662

Electronic Document Management


Document Available icon

icon_edmdoccheckedout

663

Electronic Document Management


Document Checked Out icon

icon_edmdoccheckedouttoyou 664

Electronic Document Management


Document Checked Out to You icon

icon_edmnodocument

665

Electronic Document Management


No Document icon

icon_rec_in_container

666

Record in Container icon

icon_rec_in_space

667

Record in Space icon

icon_intray

668

In Tray icon

icon_induetray

669

In/Due Tray icon

icon_missing

670

Record Missing icon

icon_record

671

Record icon

icon_securitybreach

672

Security Breach icon

icon_worktray

673

WorkTray icon

icon_bpbarcode

680

Barcode icon

icon_rpbitmap

681

Report Layout Bitmap icon

icon_rpcaption

682

Report Layout Caption icon

icon_rp_childlist

683

Report Layout Child List icon

icon_rpfield

684

Report Layout Field icon

Page 408

HP TRIM 6 Software Development Kit

icon_rpline

685

Report Layout Line icon

icon_rpproperty

686

Report Layout Property icon

icon_rprectangle

687

Report Layout Rectangle icon

icon_reports

688

Report Layouts icon

icon_rp_selectors

689

Report Layout Selector icon

icon_rptabstop

690

Report Layout Tab Stop icon

icon_rptext

691

Report Layout Text icon

icon_rty_inactive

699

Record Type Inactive icon

icon_recordtype

700

Record Type icon

icon_active

705

Active icon

icon_archivedfinal

706

Archived Permanent icon

icon_archivedinterim

707

Archived Interim icon

icon_archivedlocal

708

Archived Local icon

icon_cases

709

Cases icon

icon_destroyed

710

Destroyed icon

icon_sch_inactive

711

Archive Retention Schedule Inactive


icon

icon_hold_inactive

712

Record Hold Inactive icon

icon_inactive

713

Inacive icon

icon_schlesssevere

714

Archive Retention Schedule Less


Severe icon

icon_schmaybemoresevere

715

Archive Retention Schedule May be


More Severe icon

icon_schmoresevere

716

Archive Retention Schedule More


Severe icon

icon_schedule

717

Archive Retention Schedule icon

icon_space

720

Space Management icon

icon_tdfileview

725

TopDrawer File View icon

icon_tdfolderview

726

TopDrawer Folder View icon

icon_toolstepdone

730

Tool Step Done icon

Page 409

HP TRIM 6 Software Development Kit

icon_toolsteprogress

735

Tool Step Progress icon

icon_thaspect

740

Thesaurus Aspect icon

icon_th_inactive

741

Thesaurus Inactive icon

icon_thkeynode

742

Thesaurus Key Node icon

icon_thkeyword

743

Thesaurus Keyword icon

icon_thlist

744

Thesaurus List icon

icon_thnonpreferred

745

Thesaurus Non-Preferred Term icon

icon_thprompt

746

Thesaurus Prompt icon

icon_thprompttop

747

Thesaurus Prompt Top Term icon

icon_broader

748

Thesaurus Broader Term


Relationship icon

icon_forbidden

749

Thesaurus Forbidden Term


Relationship icon

icon_narrower

750

Thesaurus Narrower Term


Relationship icon

icon_preferred

751

Thesaurus Preferred Term


Relationship icon

icon_related

752

Thesaurus Related Term


Relationship icon

icon_thterm

753

Thesaurus Term icon

icon_topforbidden

754

Top Forbidden icon

icon_barcodescanner

760

Barcode Scanner icon

icon_stopword

765

Stop Words icon

icon_edmstore

766

Electronic Domument Store icon

icon_wkc_docoriginactin

770

Workflow Originating Document In


icon

icon_wkc_docoriginactout

771

Workflow Originating Document Out


icon

icon_wkc_docoriginWorkflow 772

Workflow Originating Document


icon

icon_wkc_docstatusclear

Workflow Document Status Clear


icon

773

Page 410

HP TRIM 6 Software Development Kit

icon_wkc_docstatusin

774

Workflow Document Status In icon

icon_wkc_docstatusnone

775

Workflow Document Status None


icon

icon_wkc_docstatustd

776

Workflow Document Status


TopDrawer icon

icon_Workflow

779

Workflow icon

icon_Workflowtemplate

805

Workflow Template icon

Page 411

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

What's New from TRIM Captura to the HP TRIM SDK


This section describes the main differences between the TRIM 5.0 interfaces and
those of the TRIM Captura (4.3), for the benefit of programmers required to upgrade
code developed against one to the other.

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

Top level object Application object

Database object

Object names

ITS_ prefix (for example,


ITS_record)

No prefix (for example, Record)

Database
connection

Explicit

Automatic to default DB

app.Connect(usr, pwd, 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

If Not obj.Save Then


Msgbox obj.ErrorMessage

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

HP TRIM 6 Software Development Kit

type.Select(hwnd, True)

.SelectAll
.SetFilter(rfElectronic)
type = .ChooseOneUI

Use ITS_recordType object

Use PropertyDefs object

.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

Uses InputDocument object


rec.GetAttribute
rec.SetAttribute

rec.GetProperty
rec.SetProperty

Uses PropertyDef object


15 properties (for example,

Multiple definable properties.

rec.Field1, rec.Date3)

rec.GetUserField
rec.SetUserField

Uses FieldDefinition object


Catalogue Mail
Messages
Relate Records
Browse Related
Records
Location
Location types

Get Current
User
Create new
external contact
locations
Create new staff
within a unit
Search
Add Search

Use ITS_mailMessage object Use InputDocument object


rec.CreateFromMailMessage

idoc.SetAsMailMessage
rec.SetDocument(idoc)

rec.SetRelated

rec.AttachRelationship

Use ITS_search object

Use RecRelationships object

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

HP TRIM 6 Software Development Kit

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

Fields specified as strings

Fields specified as enum values

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]

Access Control rec.AccessControl


Uses ITS_accessControl

recs = srch.GetRecords
recs2 = recs.ChooseManyUI

rec.SetAccessControlDetails

Page 416

HP TRIM 6 Software Development Kit

Summary of New Features

New Objects

Action Definition

Thesaurus Keywords

Classification (Record Plan)

Lookup Set & Lookup Item

Electronic Store

Field Definitions

Property Definitions

Census

Litigation Hold

History

HTML Publishing Layouts

Address

Record Locations

Record Relationships

Renditions

Revisions

Requests

Reports

Schedules & Triggers

Space Management

Digital Signatures

Security Levels & Caveats

Zip Codes (Postal Codes)

Workflow

Page 417

HP TRIM 6 Software Development Kit

New Concepts

Verification

Selecting for Collections

Making Reference Files

Property Definitions

Data Strings

Publishing to HTML

Child Lists

Enumeration Helper

Renaming Captions

System/Database Options

Page 418

HP TRIM 6 Software Development Kit

New Features In Detail

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

InputDocument (use SetAsMailMessage


method)

For new objects, see the Context object model.

Page 419

HP TRIM 6 Software Development Kit

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

HP TRIM 6 Software Development Kit

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

For more details on instantiating objects, see Accessing Persistent Objects.

Page 421

HP TRIM 6 Software Development Kit

Creating an Electronic Record


'4.3
'Select the Record Type
Set DocType = app43.MakeRecordType
If Not DocType.Select(hwnd, True) Then
MsgBox DocType.ErrorMessage, , "TRIM Image Scanner"
Set DocType = Nothing
Exit Sub
End If
'Initialise the new Record
Set detail = app43.NewRecord(DocType)

' Create a new record

'Save/Create the New Record


If detail.Create(hwnd, TopForm.ctlImgEdit.Image, True) Then
MsgBox "Created. Record Id: " + detail.Number
End If

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)

' Create a new record

Dim inDoc As New TRIMSDK.InputDocument


inDoc.SetAsFile (TopForm.ctlImgEdit.Image)
'Save/Create the New Record
If detail.SetDocument(inDoc) Then
detail.PropertiesUI (hwnd)
detail.Save
MsgBox "Created. Record Id: " & detail.Number
End If

For more details on creating objects generally, see Creating a New Object.

Page 422

You might also like