Lazarus

Programming => General => Topic started by: DeBritto on May 16, 2019, 06:52:36 am

Title: StringGrid: Drag and Drop Before or After a cell
Post by: DeBritto 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
Title: Re: StringGrid: Drag and Drop Before or After a cell
Post by: devEric69 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?
Title: Re: StringGrid: Drag and Drop Before or After a cell
Post by: jamie 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.
Title: Re: StringGrid: Drag and Drop Before or After a cell
Post by: DeBritto 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