Board index » delphi » Drag&Drop in TDBGrid doesn't work

Drag&Drop in TDBGrid doesn't work

Delphi 5:

If DragMode is dmAutomatic I cannot select a row anymore.
If DragMode is dmManual the OnStartDrag isn't fired anymore.
What basic steps have to be taken to drag a row in a TDBGrid?

-- Joe

 

Re:Drag&Drop in TDBGrid doesn't work


On Wed, 15 Dec 1999 13:16:28 +0100, "Joe Meyer"

Quote
<joe@kill_spam.iceteagroup.com> wrote:
>If DragMode is dmAutomatic I cannot select a row anymore.
>If DragMode is dmManual the OnStartDrag isn't fired anymore.

If DragMode = dmManual you need to call the grid's BeginDrag method to
initiate dragging.

---
Yorai Aminov (TeamB)
http://ourworld.compuserve.com/homepages/yaminov
(TeamB cannot answer questions received via email.
To contact me for any other reason remove nospam from my address)

Re:Drag&Drop in TDBGrid doesn't work


Quote
>If DragMode = dmManual you need to call the grid's BeginDrag method to
>initiate dragging.

which means that I have to watch OnMouseDown and start
a timer or watch for mouse movement?

I have implemented Drag&Drap with a tree control and
all I had to do was to but BeginDrag into the OnStartDrag
event (with DragMode=dmAutomatic, of course). This procedure
doesn't work with a table grid and my only explanation is
that this is a bug.

--Joe

Re:Drag&Drop in TDBGrid doesn't work


On Thu, 16 Dec 1999 14:22:41 +0100, "Joe Meyer"

Quote
<joe@kill_spam.iceteagroup.com> wrote:
>>If DragMode = dmManual you need to call the grid's BeginDrag method to
>>initiate dragging.
>which means that I have to watch OnMouseDown and start
>a timer or watch for mouse movement?

BeginDrag takes a parameter which tells it whether dragging should
start immediately. No need to monitor the mouse yourself - BeginDrag
does this for you.

---
Yorai Aminov (TeamB)
http://ourworld.compuserve.com/homepages/yaminov
(TeamB cannot answer questions received via email.
To contact me for any other reason remove nospam from my address)

Re:Drag&Drop in TDBGrid doesn't work


I know about BeginDrag's parameter but where could I call
BeginDrag? OnMouseDown of the TDbGrid isn't fired when I
click on a row that contains data. It's only fired when
I click on an area of the grid that doesn't contain rows.
I used to start dragging by implementing the OnStartDrag
event and execute BeginDrag there. But OnStartDrag is only
fired when I set DragMode to dmAutomatic. If I set it to
dmAutomatic, I cannot select a row anymore. One setting
excludes the other, that's a neverending circle...
I'm really stuck with this problem, would you mind telling me
when and where to execute TDBGrid.BeginDrag?

--Joe

Re:Drag&Drop in TDBGrid doesn't work


On Thu, 16 Dec 1999 19:06:54 +0100, "Joe Meyer"

Quote
<joe@kill_spam.iceteagroup.com> wrote:
>I know about BeginDrag's parameter but where could I call
>BeginDrag? OnMouseDown of the TDbGrid isn't fired when I
>click on a row that contains data. It's only fired when
>I click on an area of the grid that doesn't contain rows.

You can try creating a TDBGrid descendant and override the MouseDown
method.

---
Yorai Aminov (TeamB)
http://ourworld.compuserve.com/homepages/yaminov
(TeamB cannot answer questions received via email.
To contact me for any other reason remove nospam from my address)

Other Threads