Recent

Author Topic: StringGrid: Drag and Drop Before or After a cell  (Read 338 times)

DeBritto

  • Jr. Member
  • **
  • Posts: 67
StringGrid: Drag and Drop Before or After a cell
« on: May 16, 2019, 06:52:36 am »
HI Folks,
Is it possible to paint something on the bitmap of the cell that is being moved, in order to shows if the dragged cell will be dropped  AFTER or BEFORE the source cell?

I don't have a clue on how to do this. Maybe paint a small red arrow at the left or the right of the cell, if its position - compared to the target cell, the one that is below the moving bitmap - is in a far left of the far right position.

Please see the gif attached, just to have an idea.
Warm Regards,
Christian

devEric69

  • Full Member
  • ***
  • Posts: 147
Re: StringGrid: Drag and Drop Before or After a cell
« Reply #1 on: May 16, 2019, 10:22:15 am »
Hello,
just to clarify: normally, it is the change of the image-icon that indicates, when the drag is started, and where the drop is accepted. Isn't that enough?
use: Ubuntu 18.04 + Laz. 1.8.5 + FPC 3.0.5 (64 bits).

jamie

  • Hero Member
  • *****
  • Posts: 2087
Re: StringGrid: Drag and Drop Before or After a cell
« Reply #2 on: May 16, 2019, 10:54:54 pm »
You can create a new cursor and assign it to the drag cursor..

This cursor can have the image of the cell content or what ever you want..

When creating the cursor add it to the cursor list in Screen.Cursor[uniqueID] := MyImgeCursor.ReleaseHandle;

Look around for adding custom cursors to the list..

P.S.
 This uniqueID should be used through out each time you create a new cursor for the current drag operation..

 Also, the Drag operation does have a way of adding images from a list, you can look into that too.
Number 1 at blue screen app creations!

DeBritto

  • Jr. Member
  • **
  • Posts: 67
Re: StringGrid: Drag and Drop Before or After a cell
« Reply #3 on: May 17, 2019, 01:30:14 am »
Hi @Jamie,
This is a good idea! I'll try and let you know.
Best regards