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
 OnClick
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

egrobler

42 Posts

Posted - Dec 09 2013 :  15:46:49  Show Profile  Reply
Hi

If I add an object image:

ImageEnVect1.SetObjBitmapFromFile(-1, 'myimage.jpg');
ImageEnVect1.ObjKind[-1] := iekBitmap;
ImageEnVect1.SetObjRect(-1, Rect(0, 0, 800, 600));
ImageEnVect1.ObjStyle[hobj] := [ievsSelectable];
ImageEnVect1.AddNewObject();

How can I detect if the user clicks on the object/image.
I do not want the user to select or or move it, I just need an event if the user clicked on a object

Thanks
Eric

w2m

USA
1990 Posts

Posted - Dec 09 2013 :  16:04:45  Show Profile  Reply
Use the OnObjectClicked event. If you select an object the event is executed. If you just click on the background image and not on an object the event is NOT executed.:

procedure TForm1.ImageEnVect1ObjectClick(Sender: TObject; hobj: Integer);
{ ImageEnVect1ObjectClick. }
var
  iObjectKind: string;
begin
  ObjectName1.Text := string(ImageEnVect1.ObjName[hobj]);
  case ImageEnVect1.ObjKind[hobj] of
    iekNONE:
      iObjectKind := 'None';
    iekLINE:
      iObjectKind := 'Line';
    iekBOX:
      iObjectKind := 'Box';
    iekELLIPSE:
      iObjectKind := 'Ellipse';
    iekARC:
      iObjectKind := 'Arc';
    iekBITMAP:
      iObjectKind := 'Bitmap';
    iekText:
      iObjectKind := 'Text';
    iekRULER:
      iObjectKind := 'Ruler';
    iekPOLYLINE:
      iObjectKind := 'Polyline';
    iekANGLE:
      iObjectKind := 'Angle';
    iekMEMO:
      iObjectKind := 'Memo';
    iekLINELABEL:
      iObjectKind := 'LineLabel';
    iekEXTENDED:
      iObjectKind := 'Extended';
  end;
  ObjectKind1.Text := iObjectKind;
end;

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

egrobler

42 Posts

Posted - Dec 09 2013 :  17:56:17  Show Profile  Reply
Perfect, thanks!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: