Page 1 of 1

Wrong Event Order Dropping Into Active Cell

Posted: Fri Feb 10, 2006 9:12 pm
by Michel
Hi Sergey,

Summary of the problem. Drag-and-drop an object (B) into a TRichViewEdit (RV).
If dropped into text or an inactive cell of a table, the order of events is: RV.OnDragDrop followed by B.OnEndDrag (which seems to be the correct order).
If dropped into active cell, the order of events is reversed: B.OnEndDrag followed by RV.OnDragDrop. This looks like a bug to me.

The above usually doesn't cause any noticeable problems – except if dragging a custom drag object from some component that deletes the "Source" drag object in response to the OnEndDrag event. In my case, this happens to be ExpressQuantumGrid. The net result is therefore a deleted "Source" object by the time I get the RV.OnDragDrop event. But only when dropping into an active cell. By this I mean: the cell that the cursor was in before I started the drag operation.

Thank you,

Michel

Posted: Sun Feb 12, 2006 3:32 pm
by Sergey Tkachenko
Hmm, I am not sure that I have control over these events.
May be you can invent a workaround for your application?

Posted: Sun Feb 12, 2006 8:25 pm
by Michel
Yep, I probably can.

As to control over these events, I have an intuitive feeling that perhaps the out-of-order firing is caused by what RV code does when re-entering into an active InplaceEditor. I have no idea what this might be though. In my (limited) experience, something like an innocent Application.ProcessMessages() could cause strange side-effects. Or playing with WM_SETREDRAW in the "wrong" place.

Can't think of anything else...

Michel