AnnHitTestExt example for Delphi
//This example uses the caller's mouse coordinates to get the handle
// to the annotation object at the specified coordinates.
// The part of the clicked annotation is displayed in the Output window.
// If the result of the hit test is a user handle, additional information about the handle is displayed.
Procedure TForm1.ExampleAnnHitTestExt ( hObject: HANNOBJECT; hContainer: HANNOBJECT; lPointToTestX: L_INT32; lPointToTestY: L_INT32 );
var
strResult: AnsiString;
begin
LEADAnn1.AnnHitTestExt( hContainer, lPointToTestX, lPointToTestY);
if(LEADAnn1.AnnObjectHitHandle = 0 ) then
begin
ShowMessage ('There is no object to hit test.');
Exit;
end;
Case LEADAnn1.AnnPositionResult of
ANNHIT_NONE:
strResult:= 'ANNHIT_NONE';
ANNHIT_BODY:
strResult:= 'ANNHIT_NONE';
ANNHIT_NAME:
strResult:= 'ANNHIT_NAME';
ANNHIT_HANDLE:
strResult:= 'ANNHIT_HANDLE HandleIndex:= ' + IntToStr(LEADAnn1.AnnHandleIndex) + Chr(13) + 'HandleId:= ' + IntToStr(LEADAnn1.AnnHandleID);
ANNHIT_USER_HANDLE:
strResult:= 'ANNHIT_USER_HANDLE HandleIndex:= ' + IntToStr(LEADAnn1.AnnHandleIndex) + Chr(13) + 'HandleId:= ' + IntToStr(LEADAnn1.AnnHandleID);
end;
ShowMessage(strResult);
end;