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
 TImageEnMView Touch Drag and Touch Panning
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

w2m

USA
1990 Posts

Posted - Jun 26 2015 :  14:46:57  Show Profile  Reply
Nigel,

I am going crazy again over dragging a thumbnail from TImageEnMView to TImageEnVect when TImageEnMView.Gestures.Pan.Enabled := True with touch.

If panning is enabled there is no drag. I have DragMode set to manual. If you disable panning the touch drag functions. Here is my code. I think this needs to be improved a little more or I am forgetting something.

Maybe when IEBeginDrag is called the panning should be turned off and restored after a drop...

As it stands, you can either have panning without touch drag and drop or touch drag and drop without panning. Drag and drop in combination with panning functions as you would expect with the mouse.

procedure TForm1.FormCreate(Sender: TObject);
{ Initialize. }
begin
  ImageEnMView1.Gestures.Pan.Enabled := True;
  ImageEnMView1.DragMode := dmManual;
end;

procedure TForm1.ImageEnMView1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
{ Start the drag. }
begin
  ImageEnMView1.Cursor := crDrag;
  ImageEnMView1.IEBeginDrag(True);
end;

procedure TForm1.ImageEnVect1DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
{ Accept images dropped from TImageEnMView. }
begin
  if Source is TImageEnMView then
    Accept := True;
end;

procedure TForm1.ImageEnVect1DragDrop(Sender, Source: TObject; X, Y: Integer);
{ Respond to Drag and Drop. }
begin
  { Drop an object into a layer }
  if Source is TImageEnMView then
  begin
  end;
end;




Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development

xequte

38615 Posts

Posted - Jun 28 2015 :  15:05:22  Show Profile  Reply
Hi Bill

I think the main issue here is how should ImageEn determine whether a drag is a Pan or the initiation of a drag drop? How does Explorer differentiate?


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

w2m

USA
1990 Posts

Posted - Jun 28 2015 :  15:14:23  Show Profile  Reply
I have no idea how explorer does it, but maybe when IEBeginDrag is called the panning should be turned off and restored after a drop if Gestures.Pan.Enabled is true ...

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

xequte

38615 Posts

Posted - Jun 28 2015 :  22:37:12  Show Profile  Reply
Hi Bill

When would panning occur if IEBeginDrag is called on mouse down?

In TImageEnMView.WMGestureNotify() and TImageEnMView.WMGesture() try changing:

  if fGestures.Enabled and IEHasGestures() then

To:

  if fGestures.Enabled and IEHasGestures() and ( not fDragging ) then


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

w2m

USA
1990 Posts

Posted - Jun 29 2015 :  15:11:36  Show Profile  Reply
I changed the code as you suggested and found the touch drag still did not work. When you try to drag, the component is still in pan mode so when you drag, the component tries to pan rather than allowing dragging... So I added some brute force:
procedure TForm1.ImageEnVect1DragDrop(Sender, Source: TObject; X, Y: Integer);
{ Respond to ImageEnVect Drag and Drop. }
begin
  ...
  ImageEnMView1.Gestures.Pan.Enabled := True;
  ...
end;

procedure TForm1.ImageEnMView1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
{ Start the drag. }
begin
  ...
  ImageEnMView1.IEBeginDrag(True);
  ImageEnMView1.Gestures.Pan.Enabled := False;
  ...
end;

This code in combination with the code change improved touch dragging so at least touch drag and drop works. I think this makes it work better but not perfect yet. Unfortunately if you start a drag but do not drop the object, panning remains turned off. Any ideas on how to turn panning on if the drop does not occur? Maybe Fabrizio can look at our discussion here and see what he thinks. Maybe there is a way in the components code to turn off panning when dragging and then restore panning on a drop.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

xequte

38615 Posts

Posted - Jun 29 2015 :  22:18:12  Show Profile  Reply
Hi Bill

Are you sure you changed both instances of:

if fGestures.Enabled and IEHasGestures() then


Otherwise you can also re-enable Gestures.Pan in the EndDrag event.


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

w2m

USA
1990 Posts

Posted - Jun 30 2015 :  07:22:30  Show Profile  Reply
Yes I modified both instances. You can not enable panning in OnEndDrag because the event is executed when you touch a thumbnail. So as a result when OnMouseDown turns off panning, OnEndDrag turns it immediately back on.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

xequte

38615 Posts

Posted - Jul 01 2015 :  23:25:20  Show Profile  Reply
Hi Bill

I'll get Fabrizio to take a look at it.



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