Recent

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

DeBritto

  • Jr. Member
  • **
  • Posts: 68
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

  • Hero Member
  • *****
  • Posts: 648
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: Linux 64 bits (Ubuntu 20.04 LTS).
Lazarus version: 2.0.4 (svn revision: 62502M) compiled with fpc 3.0.4 - fpDebug \ Dwarf3.

jamie

  • Hero Member
  • *****
  • Posts: 6091
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.
The only true wisdom is knowing you know nothing

DeBritto

  • Jr. Member
  • **
  • Posts: 68
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

 

TinyPortal © 2005-2018