[D6] access violation on BeginDrag


2004-03-05 07:18:38 PM
delphi241
After porting an application from Delphi 4 to Delphi 6 (essentially
without modifications to the source code) I receive access violations
after calling the BeginDrag method of a TDrawGrid, where Delphi 4 has
worked well.
The draw grid is essentially a colour palette where the user can drag
a color to another component of the form. Its drag mode is dmManual
because I don't get the cell selected in automatic mode. Dragging
begins in the OnSelectCell event:
procedure TMarkerStyleDlgForm.ColorsGridSelectCell(Sender: TObject;
ACol,
ARow: Integer; var CanSelect: Boolean);
begin
canSelect := ARow * ColorsGrid.ColCount + ACol < Length(Colors);
if canSelect then ColorsGrid.BeginDrag(false);
end;
A couple of AVs occurs just when clicking a (selectable) cell of the
grid, even if the mouse is not moved while the button is held down.
Furthermore, subsequent AVs occur in intervals of a couple of seconds
even after the window is closed. If the form is not used after program
start no AVs occur. Also, no AVs occur if the form is used when just
the BeginDrag method is not present in the code.
The problem occurs also in a minimum application with just this dialog
form with one draw grid. Additionally, it occurs the same way with the
original Delphi libraries as well as the service pack 3, and on both
Windows 2K and XP professional. I use the professional edition of
Delphi.
Any help towards the solution of this problem would be kindly
appreciated. I am also able to send you the example code of the
minimal application. If nobody knows the problem I probably should
contact Borland directly.
Thank you for your attention.
matthias