# OnImageClick Event

## Applies to

THtmlViewer, TFrameViewer, and TFrameBrowser components

## Declaration

property OnImageClick: TImageClickEvent;

## Description

The OnImageClick event occurs when the mouse is over an image and either mouse button is clicked. See the TImageClickEvent type for information on the parameters.

## Example

The following code may be used to popup a menu when right clicking on an image:

procedure TForm1.ImageClick(Sender, Obj: TObject;

Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

var

Pt: TPoint;

begin

if Button = mbRight then

if (Obj is TImageObj) then

begin

FoundObject := TImageObj(Obj);

GetCursorPos(Pt);

PopupMenu.Popup(Pt.X, Pt.Y);

end;

end;

Here FoundObject is a TForm1 field used to save the calling TImageObj for use after the menu selection has been made. See the TImageObj type definition in HTMLSUBS.PAS for further imformation on this type. In particular, the field, TImageObj.Source, holds the image's filename, and the property, TImageObj.Bitmap, can be used to obtain a copy of the bitmap itself.

See also:

OnImageOver Event

OnObjectClick Event

OnRightClick Event