Board index » delphi » Bevel Events

Bevel Events

Hi there!

i've got a little problem, i've got an image and i need that in a area of
the image, when the user click in that area, it does some action. the only
way i've found for that is using a bevel, wich is transparent, but it has no
events! how can i do that? is there any other componant transparent ??

TIA

 

Re:Bevel Events


Why not just locate the coordinated of the mouse in the image's OnClick
event? Use PtInRect to see if the mouse coordinates exist in the area
(rect) to be checked.

procedure TForm1.Image1Click(Sender: TObject);
var
  MPt: TPoint;
  MRect: TRect;
begin
  MPt := Image1.ScreenToClient(Mouse.CursorPos);
  MRect := Image1.ClientRect;
  MRect.Top := 0;
  MRect.Left := 0;
  MRect.Right := 10;
  MRect.Bottom := 10;
  if PtInRect(MRect,MPt) then
    ShowMessage('Upper-left corner clicked');
end;

Just change the values of the Rect to contain the desired coordinates
you want to check. You can use more than one rect and just check them
all if you need to. There's probly a better or more efficient way to do
this but it seems like the easiest solution to me  =)

Quote
Kane wrote:

> Hi there!

> i've got a little problem, i've got an image and i need that in a area of
> the image, when the user click in that area, it does some action. the only
> way i've found for that is using a bevel, wich is transparent, but it has no
> events! how can i do that? is there any other componant transparent ??

> TIA

--

1 + 1 = 2  but  '1' + '1' = '11'

Re:Bevel Events


Thanks!
in the meanwhile i had figured out how to use that, i used the coordinate
thing too :)
i'll search for that component, may be usefull ;)

thanks again !

"John of Aix" <j.mur...@NOJUNKMAILlibertysurf.fr> wrote in message
news:aipa8e$lie$7@news2adm.admin.in.none.net...

Quote
> Kane wrote:
> > Hi there!

> > i've got a little problem, i've got an image and i need that in a
> > area of the image, when the user click in that area, it does some
> > action. the only way I've found for that is using a bevel, wich is
> > transparent, but it has no events! how can i do that? is there any
> > other componant transparent ??

> I always use the OnMouseDown event for this sort of thing, then I get
> the coordinates and check them. Or I use a component called Hotspot
> which allows you to set a hotspot anywhere. I probably found it at Torry
> so you could try there.

Other Threads