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
 Layer click

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
egrobler Posted - Sep 23 2012 : 11:23:16
Hi

How can I determine if a user clicked on a particular layer.

Thanks
Eric

4   L A T E S T    R E P L I E S    (Newest First)
egrobler Posted - Sep 24 2012 : 07:28:11
Thanks William

iLayer:= ImageEnView1.FindLayerAt(X, Y, True);

It works perfectly :-)
w2m Posted - Sep 24 2012 : 07:03:35
Try this:
procedure TForm1.ImageEnView1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
  iLayer: integer;
begin
  iLayer:= ImageEnView1.FindLayerAt(X, Y, True);
  StatusBar1.Panels[6].Text := 'Current layer: ' + IntToStr(iLayer) + '.'
end;

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
egrobler Posted - Sep 23 2012 : 23:40:37
Hi William,

Thanks for your response.

My problem is that OnLayerNotify is not fired with my settings which is MouseInteract := [miSelect]. I do not want to use miMoveLayers.

I have a background with various icons and would like to react if the user clicks on any of the layers (icons)

Regards
Eric
w2m Posted - Sep 23 2012 : 14:42:33
The OnLayerNotify event occurs whenever a layer is selected, moved or resized.
procedure TForm1.ImageEnView1LayerNotify(Sender: TObject; layer: Integer; event: TIELayerEvent);
var
  iDimensions: string;
begin
  if event = ielSelected then
  begin
    // user selected a layer 
    // layer is the layer index of the selected layer
    // to get layer info look at layer property
    // you can get the layers width, height, position... 
    iDimensions := IntToStr(ImageEnView1.Layers[layer].Width) + '     pixels x ' + IntToStr(ImageEnView1.Layers[layer].Height) + ' pixels';
  end;
end;

Look at the help file as well.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html