Forum > LCL

Drag on Stringgrid

(1/1)

coimbras:
Hello.

Is possible to drag values from a "cell" to those under it? Like in Excel?
If i select a cell, drag it value also to a emty cell under the first?
I checke the properties tha says "drag" but it does not work.

Many thanks.

Handoko:
I think it is possible because TStringGrid has OnStartDrag and OnDragDrop events.

If you're going to write something like Excel, try FPSpreadsheet:
http://wiki.freepascal.org/FPSpreadsheet

jamie:
Without code example it's hard to say..

I just tested it on windows 10-64 bit target and it works.

The drag operation is a little anemic and thus you need to help it along...

First you can set the DragMode to dmAutomatic, this will start the drag operation as you click and drag on
the cells.

 In the OnStartDrag event you can create a TDragObject, this object is one you need to create and thus
serves as a base class to a class you have created, the virtual methods it provides need to be overridden.
 
  as for dropping in other applications, I think you need to implement the IDataObject and related api code for
windows or, do the copy clipboard and paste operation..

 at the end of the drop operation the LCL should free the object you created, you don't need to..

Navigation

[0] Message Index

Go to full version