noch ne kurze Rückmeldung mit der Lösung.. evtl. stört dieses Problem ja noch jemanden anderen
Delphi-Quellcode:
TMyGrid = class(TDBGrid)
private
FMouseWasDown: Boolean;
FColumnMoved: Boolean;
protected
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure ColumnMoved(FromIndex, ToIndex: Longint); override;
procedure TitleClick(Column: TColumn); override;
end;
procedure TMyGrid.ColumnMoved(FromIndex, ToIndex: Integer);
begin
FColumnMoved := True;
inherited;
end;
procedure TMyGrid.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FMouseWasDown := true;
FColumnMoved := false;
inherited;
end;
procedure TMyGrid.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
try
inherited;
finally
FMouseWasDown := false;
end;
end;
procedure TMyGrid.TitleClick(Column: TColumn);
begin
if FMouseWasDown and (not FColumnMoved) then
begin
inherited;
end;
end;