When you say you've "taken over the OnMouseDown handler", what do you
mean? Do you have your own WndProc for your control? It's in the
WndProc for TControl that csLButtonDown becomes set, in response to a
WM_LBUTTONDOWN message. Check that you're reproducing this default
behaviour, or passing to the default TControl.WndProc if needed.
As a test, I tried the same thing with a TStringGrid created at runtime.
For me, csLButtonDown is set (via the call stack, from TControl.WndProc)
and I get the OnStartDrag.
Cheers,
Carl Reynolds Ph: +64-9-4154790
CJN Technologies Ltd. Fax: +64-9-4154791
[EMAIL PROTECTED] DDI: +64-9-4154795
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/
> -----Original Message-----
> From: Leo Ramakers [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, October 21, 1999 1:08 PM
> To: Multiple recipients of list delphi
> Subject: [DUG]: Drag problem
>
> I am trying to implement drag and drop behaviour in a Diary component
> I am writing. The component is derived from TScrollbox, and contains a
> number of TStringGrids. I need to be able to drag the contents of a
> cell in one StringGrid and drop into a cell elsewhere. I have taken
> over the OnMouseDown handler in the source grid, and call BeginDrag
> from it.
>
> procedure TFormBeds.myMouseDown(Sender: TObject; Button: TMouseButton;
>
> Shift: TShiftState; X, Y: Integer);
> begin
> if Button = mbLeft then
> with Sender as TStringGrid do
> BeginDrag(False,10);
> end;
>
> I have taken over the OnStartDrag handler, but it doesnt get called
> for some reason, athough the same OnStartdrag handler does get called
> for the components I drop on the form manually. Buried inside the
> 'Controls' code I find that the manually crafted components take a
> branch in the tControl.BeginDrag handler {if csLButtonDown in
> ControlState}where my runtime created component fails that branch
> because the ControlState is an empty set.
>
> Does anyone have any clues?
>
> I am writing a 'diary' application, where the diary manages bookings
> for different rooms. Unfortunately the time period for each room is
> varied, so I cant use a multicolumn stringrid and chose to use a
> number of single column stringGrids side by side. I need to take over
> the whole bagage of mouse events to handle clicks, double clicks, and
> drag/drop, but the event behaviour is not straighforward.
>
> best regards
> Leo
>
> ----------------------------------------------------------------------
> ----- New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED] Website: http://www.delphi.org.nz
application/ms-tnef