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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Need to check if user clicked on a layer

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
serverinfo Posted - Jan 21 2020 : 11:46:40
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.
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jan 21 2020 : 19:53:34
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