ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Need to check if user clicked on a layer
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

serverinfo

Brazil
9 Posts

Posted - Jan 21 2020 :  11:46:40  Show Profile  Reply
I am using the OnMouseDown and OnMouseUp of the Image component and need to know if the position the user clicked has a layer or not, and wich layer it is. Basically i need to do something when a user clicks a layer and do other stuff when the user click an area that has no layer under the mouse position.

How can i do that?

Thank You.

xequte

38175 Posts

Posted - Jan 21 2020 :  19:53:34  Show Profile  Reply
Hi

Please use FindLayerAt:

https://www.imageen.com/help/TImageEnView.FindLayerAt.html

Here is an example:

// Show which layer is under the cursor
procedure TMainForm.ImageEnView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
  lyr: Integer;
begin
  lyr := ImageEnView1.FindLayerAt( X, Y );
  if lyr < 0 then
    lblLayer.Caption := 'Layer: None'
  else
    lblLayer.Caption := 'Layer: ' + IntToStr( lyr );
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: