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
 OnMouseMove may prevent OnImageSelect
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

JimMellish

United Kingdom
7 Posts

Posted - Aug 25 2017 :  04:13:30  Show Profile  Reply
I have found that OnImageSelect may not fire if OnMouseMove is being used for drag and drop and the selected image is changed using the mouse.

I have a form with only a TImageEnMView on it and the following code:

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  ImageEnMView.FillFromDirectory('F:\Photographs\Digital\A40');
end;

procedure TForm1.ImageEnMViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if ssLeft in Shift then
    begin
      ImageEnMView.MouseInteract := [];
      ImageEnMView.IEBeginDrag (True, -1);
    end;
end;

procedure TForm1.ImageEnMViewImageSelect(Sender: TObject; idx: Integer);
begin
  CodeSite.Send ('OnImageSelect');
end;

end.


If I only use the mouse, I can only click on five or six different thumbnails before the selected thumbnail stops updating (the blue border indicating the selected image stops changing) and OnImageSelect stops firing.

I am using Windows 10, Delphi 10.1 Berlin Update 2 and ImageEn 7.0

Jim

xequte

39053 Posts

Posted - Sep 01 2017 :  20:04:16  Show Profile  Reply
Hi Jim

IEBeginDrag is being called, but you do not call IEEndDrag, so the control still thinks it is dragging.

Please add the event:

procedure TForm1.ImageEnMView1EndDrag(Sender, Target: TObject; X, Y: Integer);
begin
  ImageEnMView1.IEEndDrag;
  ImageEnMView1.MouseInteract := [mmiSelect];
  ImageEnMView1.Paint;
end;

You might also want to try the demo \Demos\DragDrop\MultiView2\

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

JimMellish

United Kingdom
7 Posts

Posted - Sep 06 2017 :  05:59:31  Show Profile  Reply
Hi,

That has solved my problem.

When I was clicking on the individual images in the ImageEnMView I was doing it so fast that sometimes I started a drag drop operation without realising.

Also, I was calling IEEndDrag etc in the OnDragDrop event of another component, so if I dropped on this other component everything worked ok.

AS you suggested, I have moved the IEEndDrag etc to the OnEndDrag event of ImageEnMView so the dragging is terminated correctly in all cases.

Thanks, Jim

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: