JAM-Software / Virtual-TreeView

Virtual Treeview is a Delphi treeview control
http://www.jam-software.de/virtual-treeview/
643 stars 251 forks source link

Remove TVTDragImageStates.disSystemSupport #806

Open joachimmarder opened 6 years ago

joachimmarder commented 6 years ago

It indicates that application is running on Windows 2000 or higher where IDragSourceHelper is available. Windows 98 support has been dropped a long time ago. Along with thia flag InternalShowDragImage(), RecaptureBackground(), DragTo() and MakeAlphaChannel() can be removed, which are only used if the OS does not natively support drag images.

joachimmarder commented 6 years ago

GetVisible() can also be removed because it will return always False on Windows 2000 or higher. And also code that is executed only if GetVisible() returns True can be removed.

Also MoveRestriction does not make sense any more afterwards.

pyscripter commented 6 years ago

+1

joachimmarder commented 6 years ago

Header dragging still uses old code without IDragSourceHelper, we first need to revise header dragging code.

joachimmarder commented 5 years ago

For header dragging it seems that we will need a dummy IDataObject implementation to that we can attach a bitmap using IDragSourceHelper.InitializeFromBitmap() in TVTDragImage.PrepareDrag().

joachimmarder commented 3 years ago

we will need a dummy IDataObject implementation to that we can attach a bitmap

A quick test with TVTDataObject.Create(FOwner, False) did not work.

joachimmarder commented 1 week ago

The minimum code to show a Windows drag image is to add this at the end of TVTHeader.PrepareDrag() before finally:

      var lDataObject := TVTDataObject.Create(nil, False);
      FDragImage.PrepareDrag(Image, ImagePos, P, lDataObject);
      var lDragEffect: DWord;                    // The last executed drag effect
      SHDoDragDrop(fOwner.Handle, lDataObject, nil, DROPEFFECT_MOVE, lDragEffect); // supports drag hints on Windows Vista and later

However, the call to SHDoDragDrop() prevents normal mouse move messages from arriving.