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
 Drag n Drop in the same ImageEn*MView

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
lago Posted - Mar 29 2016 : 13:25:02
Hello all, i have a question about drag and drop in the same ImageEn*MView.

As can I move the thumbnails to different positions in the same ImageEn*MView ?

For example, i have four thumbnails like this



... and for example, i want can choose the last thumb (img_4038.jpg) to the first position where are img_4028.jpg with drag method.

Seeing examples i found MultiView sample project, but only work in a single vertical colum. I have multiple horizontal colums, i think its a problem.

Someone can help me? What is the best way to do it?


Thanks alot.

Jorge.
5   L A T E S T    R E P L I E S    (Newest First)
spetric Posted - Mar 19 2019 : 15:41:13
@largo

One M is missing in your code (if we speak about ImagEnMView):

mView->MouseInteract = TIEMMouseInteract() << mmiSelect;


aleatprog Posted - Mar 19 2019 : 02:29:49
I got a question about Bill's code:

Is it possible to enable drag&drop only if the mouse pointer is on the thumbnail area while clicking, and allow multiple selection if the pointer is outside the thumbnail while clicking?

In short words: the same behaviour as in Windows Explorer.

Using Bill's code, even if I click outside the thumbnail area the drag&drop modus for the thumbnail is active and multiple thumbnail selection is only possible using the shift or ctrl key.
lago Posted - Apr 07 2016 : 05:42:53
Umm i have some problems with MouseInteract in C++, i found this:
http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=1532&SearchTerms=MouseInteract,C++

ImageEnView1->MouseInteract = TIEMouseInteract()<<mmiSelect;

But not run
[bcc32 Error] Unit1.cpp(1317): E2094 'operator<<' not implemented in type 'TIEMouseInteract' for arguments of type 'TIEMMouseInteractItems'

Someone know where is the problem?

Thanks for all.

Jorge.
lago Posted - Mar 31 2016 : 22:19:52
Thanks alot Bill, nice example :) now i will try port to C

w2m Posted - Mar 29 2016 : 15:48:12
Add the following code to the Horizontal ImageEnMView:
procedure TMainForm.ImageEnMViewHorzontal1AfterEvent(Sender: TObject; Event: TIEAfterEvent);
{ This draws the insert point vertical red line }
var
  imgX, imgY :integer;
begin
  if (Event = ieaePaint) and ImageEnMViewHorzontal1.Dragging and (fDragInsertPos > -1) then
  begin
    if fDragInsertPos >= ImageEnMViewHorzontal1.ImageCount then
    begin
      // Position at end of last thumbnail
      imgX := ImageEnMViewHorzontal1.ImageX[ImageEnMViewHorzontal1.ImageCount - 1] - ImageEnMViewHorzontal1.ViewX;
      imgY := ImageEnMViewHorzontal1.ImageY[ImageEnMViewHorzontal1.ImageCount - 1] - ImageEnMViewHorzontal1.ViewY + ImageEnMViewHorzontal1.ThumbHeight - 2;
    end
    else
    begin
      // Position before current thumbnail
      imgX := ImageEnMViewHorzontal1.ImageX[fDragInsertPos] - ImageEnMViewHorzontal1.ViewX;
      imgY := ImageEnMViewHorzontal1.ImageY[fDragInsertPos] - ImageEnMViewHorzontal1.ViewY + 1;
    end;
    with ImageEnMViewHorzontal1.GetCanvas do
    begin
      Pen.Color := clRed;
      Pen.Width := 3;
      Pen.Style := psSolid;
      MoveTo(ImgX, 0);
      LineTo(ImgX,  ImgY + ImageEnMViewHorzontal1.ThumbHeight);
    end;
  end;
end;

procedure TMainForm.ImageEnMViewHorzontal1DragDrop(Sender, Source: TObject; X, Y: Integer);
{ This moves the selected image to the inserting point }
var
  im:integer;
begin
  ImageEnMViewHorzontal1.MultiSelectSortList;  // selection order is not important
  im := ImageEnMViewHorzontal1.InsertingPoint(X, Y);
  ImageEnMViewHorzontal1.MoveSelectedImagesTo(im);
end;

procedure TMainForm.ImageEnMViewHorzontal1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState;
  var Accept: Boolean);
begin
  fDragInsertPos := -1;
  if Source = ImageEnMViewHorzontal1 then
  begin
    Accept := True;
    fDragInsertPos := ImageEnMViewHorzontal1.InsertingPoint(X, Y);
  end;
  ImageEnMViewHorzontal1.Paint;
end;

procedure TMainForm.ImageEnMViewHorzontal1EndDrag(Sender, Target: TObject; X, Y: Integer);
begin
  ImageEnMViewHorzontal1.IEEndDrag;
  ImageEnMViewHorzontal1.MouseInteract := [mmiSelect];
  ImageEnMViewHorzontal1.Paint;
end;

procedure TMainForm.ImageEnMViewHorzontal1ImageSelect(Sender: TObject; idx: Integer);
begin
  // Copy image
  ImageEnMViewHorzontal1.CopyToIEBitmap( idx, ImageEnVect1.IEBitmap );
  // Copy annotations
  ImageEnVect1.RemoveAllObjects;
  ImageEnMViewHorzontal1.MIO.Params[idx].ImagingAnnot.CopyToTImageEnVect(ImageEnVect1);
  ImageEnVect1.Update;
end;

procedure TMainForm.ImageEnMViewHorzontal1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if (ssLeft in Shift) then
  begin
    ImageEnMViewHorzontal1.MouseInteract := [];
    ImageEnMViewHorzontal1.IEBeginDrag(true, -1);
  end;
end;

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