VpeSetObjectID

<< Click to Display Table of Contents >>

Navigation:  Clickable Objects >

VpeSetObjectID

Previous pageReturn to chapter overviewNext page

[Windows platform only, Professional Edition and above]

Defines an Object ID that will be assigned to the next object(s), that are inserted into the document. With the Object ID you are able to identify a clicked object later when showing the preview. When the user clicks onto such an object with an assigned ID, the VPE_OBJECTCLICKED event is sent together with the Object ID to your application.

The Object ID may have any value that can be represented with a long integer. The Object ID has to be different from 0 (zero). Setting the Object ID to zero means, that the object is not clickable.

void VpeSetObjectID(

VpeHandle hDoc,

int id

)

VpeHandle hDoc

Document Handle

int id

an Object ID to identify the clicked object when processing the VPE_OBJECTCLICKED event

Default:

0

Remarks:

You may assign one and the same Object ID to any number of objects. It is the whole responsibility of your application, how it will work with Object ID's.

 

The following objects can be assigned an Object ID (and therefore can be made clickable):

Box

Ellipse

Pie

Print(-Box)

Write(-Box)

Picture

Barcodes (1D and 2D)

RTF

Charts

UDO

FormField

Example:

VpeSetObjectID(hDoc, 1)

VpePrint(hDoc, 1, 1, "Monthly Report")

Assigns the ObjectID 1 to the text object "Monthly Report".

 

VpeSetObjectID(hDoc, 2)

VpePicture(hDoc, 1, 1, VFREE, VFREE, "data.bmp")

Assigns the ObjectID 2 to the image "data.bmp".

 

VpeSetObjectID(hDoc, 0)

VpePrint(hDoc, 1, VBOTTOM, "This image shows data.")

Assigns NO ObjectID to the text object "This image shows data.". Therefore this object is not clickable.

 

Processing of the VPE_OBJECTCLICKED event in C/C++

(in the window-procedure of the parent window of the VPE preview):

case VPE_OBJECTCLICKED:

 wsprintf(s, "Object #%d was clicked", VpeGetObjectID(lParam));

 MessageBox(hWnd, s, "CLICK:", MB_OK);

 break;

The event handler in the example above will show a message box with the Object ID of the clicked object.