LAnnContainer::HitTest

#include "ltwrappr.h"

virtual LAnnotation L_FAR * LAnnContainer::HitTest(pPoint, puResult)

virtual L_INT LAnnContainer::HitTest(pPoint, puResult, phObjectHit)

LPPOINT pPoint;

/* pointer to the POINT structure */

L_UINT L_FAR * puResult;

/* position on the annotation object that was hit */

pHANNOBJECT phObjectHit;

/* handle to the annotation object that was hit */

LAnnContainer::HitTest(pPoint, puResult, phObjectHit) gets the handle to the annotation object that is located at a specified point. If objects overlap, this function gets the front object.

LAnnContainer::HitTest(pPoint, puResult) gets the annotation object that is located at a specified point. If objects overlap, this function gets the front object.

This function is available in the Document/Medical Toolkits.

Parameter

Description

pPoint

Pointer to the POINT structure that specifies the point to test. Coordinates are relative to the associated window's client area.

puResult

The position on the annotation object that was found at the specified point. The following are possible values:

 

ANNHIT_NONE [0]

 

ANNHIT_BODY [1]

 

ANNHIT_HANDLE [2]

 

ANNHIT_NAME [3]

phObjectHit

Address of the variable to be updated with the handle to the annotation object that is found at the specified point.

Returns

LAnnContainer::HitTest(pPoint, puResult, phObjectHit) returns the following:

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

LAnnContainer::HitTest(pPoint, puResult) returns the following:

A pointer to the annotation object that is located at the specified point. The user is responsible for deleting the returned object.

Comments

Before calling LAnnContainer::HitTest(pPoint, puResult, phObjectHit), you must declare a variable of data type HANNOBJECT. Then pass the address of the variable in the phObjectHit parameter. This function will update the variable with the handle of the object located at the specified point.

You can attach phObjectHit to an LAnnotation class object and call LAnnotation::GetType to determine the annotation object type.

When using LAnnContainer::HitTest(pPoint, puResult), you can call LAnnotation::GetType to determine the annotation object type of the returned object.

Required DLLs and Libraries

LTANN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

Class Members

Topics:

Annotation Functions: Using Window Coordinates to Select Objects

 

Annotation Functions: Object Information

 

Displaying and Manipulating Annotation Objects

Example

This is an example forLAnnContainer::HitTest(pPoint, puResult, phObjectHit):

L_VOID TestHitTest (LAnnContainer& LeadAContainer,pHANNOBJECT phAnnObject,
                    L_INT xFromWindow, L_INT yFromWindow)
{
   HANNOBJECT ThisObject; // Local variable for the annotation object 
   POINT PointToTest;// The point in the window's client area to test
   L_UINT TestResult; // Result of the test 
   
   // Use incoming coordinates to specify the point to test
   PointToTest.x = xFromWindow;
   PointToTest.y = yFromWindow;

   // Get the object at the specified point 
   LeadAContainer.HitTest( &PointToTest, &TestResult, &ThisObject);
   
   // Update the caller's object variable
   if (TestResult == ANNHIT_NONE)
      *phAnnObject = 0;
   else
      *phAnnObject = ThisObject;     
}

This is an example for LAnnContainer::HitTest(pPoint, puResult):

L_VOID TestHitTest (LAnnContainer& LeadAContainer,LAnnotation L_FAR * pLeadAnn,
                    L_INT xFromWindow, L_INT yFromWindow)
{
   POINT PointToTest;// The point in the window's client area to test
   L_UINT TestResult; // Result of the test 
   
   // Use incoming coordinates to specify the point to test
   PointToTest.x = xFromWindow;
   PointToTest.y = yFromWindow;

   // Get the object at the specified point 
   pLeadAnn = LeadAContainer.HitTest( &PointToTest, &TestResult);
}