Configuring a Custom Component
You can configure a Custom Component in the Configure Custom Component dialog box. To do so:
1. In the Component name field, specify the name of the Custom Component to be displayed in the Workspace. By default, "Custom Component" is displayed.
2. From the Context from list, select the Workspace from which the current Component must receive Context.
Select None if the Custom Component does not require Context.
If you select this option, the Set Context button is disabled.
- OR -
Select Component in this Workspace to configure the items in the current Component to receive Context from items in another Component, within the same Workspace. The Set Context button is enabled.
a. Click the Set Context button.
The Set Context dialog box is displayed. In the Set Context dialog box, the Component column lists the Components that can provide context to the current Component. In the Object column, the Object selected in the current Component is displayed. In the Relationship with <Object> column, all Relationships of the Object of the Component providing Context with the Object of the current Component are displayed.
b. From the Component column, select the Component from which the data in the current Component must receive Context.
c. From the Relationship with <Object> list, select the Relationship that must provide Context to the current Component.
- OR -
Select Component in another Workspace, to configure the current Component to receive Context from a Component in a different Workspace.
a. Click the Set Context button.
The Set Context dialog box is displayed.
b. In the Set Context dialog box, select the Relationship that must provide Context to the current Component. This option is enabled only if the current Workspace is based on an Object. The Component will display data based on the data provided by the Component providing the Context.
Example A Workspace displaying the Accounts Table View in a Pane provides Context to a Custom Component (an OCX file) configured to display Account details in another Pane. You can update an Account item in Talisma with the information provided in the Custom Component. |
3. Click OK.
The Configure Custom Component dialog box is displayed.
4. From the Custom Component list, select the Custom Component that must be configured in the current Component.
All Custom Components registered on your computer are displayed in the list.
5. Click OK.
The Custom Component is configured.
Example for Creating the Custom OCX Component in Visual Basic
When creating a custom OCX Component in a user-defined Workspace, you can specify whether the Component takes Context. Given below is an example on how you can create such a Component in Visual Basic (VB).
Implement the following interface:
Implements ITLCustomDeskComponent
This interface is implemented in TLUICtx.dll, which is registered on your computer when you install Talisma Client. To use this interface, click Project->References, and select “TalismaUIContext 4.0 Type Library”
Some of the common methods you need to implement in your code are:
Method 1
Private Sub ITLCustomDeskComponent_TLInitialize(ByVal vtBOTalisma As Variant, ByVal lDeskID As Long, ByVal lInstanceID As Long).
The following table describes the parameters passed:
Name of the field |
Description |
VtBOTalisma |
The TLAPI handle. You can use this parameter to perform TLAPI operations. For example: • Dim TLAPI, DBName • Set TLAPI = vtBOTalisma • DBName = TLAPI.DatabaseName The database name is picked up from the TLAPI handle and stored in the local variable named DBName. |
lDeskID |
The ID of the Workspace in which the custom Component is embedded. |
lInstanceID |
This is the instance ID. It is not required. |
Method 2
Private Sub ITLCustomDeskComponent_ServiceRequest
(ByVal vtRequestContextIDs As Variant,
ByVal vtRequestContextValues As Variant,
pvtResponseContextIDs As Variant,
pvtResponseContextValues As Variant)
This function is called whenever Context is to be passed to the Component.
The following table describes the parameters used:
Name of the field |
Description |
VtRequestContextIDs |
An array that contains the attributes of the Context being passed. These attributes are defined in the file DeskMgrConstants.h under the heading ‘ATTRIBUTES”. The following example shows how you can get the attributes: Dim ObjectType, ObjectID, TeamID For i = LBound(vtRequestContextIDs) To UBound(vtRequestContextIDs) Select Case vtRequestContextIDs(i) Case TLATTRIBUTE_OBJECT_TYPE ObjectType = vtRequestContextValues(i) Case TLATTRIBUTE_OBJECT_ID ObjectID = vtRequestContextValues(i) Case TLATTRIBUTE_TEAM_ID TeamID = vtRequestContextValues(i) Case Else End Select Next Refer to the DeskMgrConstants.h file for more details. The constants are defined as: #define TLATTRIBUTE_OBJECT_TYPE 6 #define TLATTRIBUTE_OBJECT_ID 7 #define TLATTRIBUTE_WORKSPACE_ID 27 #define TLATTRIBUTE_TEAM_ID 29 Define all the attribute constants in a *.bas VB file for local use. For example, you can create a file GlobalVariables.bas in your VB project and define the constants as: Public Const TLATTRIBUTE_OBJECT_TYPE As Long = 6 This makes it easier to use constants. Look at the ‘For’ loop. (It is assumed that you have the .bas file ready with all the constants defined.) You loop through the array and get the values that you require. There may be instances when you may not get values of the attributes. For example, you will not get Team ID if the context is passed by the Account Object. In that case, the value TeamID will be -1. |
VtRequestContextValues |
This parameter has the values of the corresponding Context attribute IDs as mentioned in the description of the variable vtRequestContextIDs. There are other methods that the interface exposes that are not required for the sample. |