I think I found a bug. Below is an empty project with 1 panel and in the uses only uses ldockttree added. If you click on the panel, nothing happens. If you check the box so that the panel becomes a dock site and then click on the panel then you get an AV.
The av is caused in the class procedure
TDockHeader.PerformMouseDown(AControl: TControl;
of Ldocktree.pas.
If I adjust this function as follows, the AV is gone
class procedure TDockHeader.PerformMouseDown(AControl: TControl;
APart: TLazDockHeaderPart);
begin
if AControl = nil then Exit; // <----- new line added.
case APart of
ldhpAll, ldhpCaption:
// mouse down on not buttons => start drag
AControl.BeginDrag(False);
end;
end;
Is this a bug or am I overlooking something else?
The full sample code:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
CheckBox1 : TCheckBox;
Panel1 : TPanel;
procedure CheckBox1Change(Sender : TObject);
private
public
end;
var
Form1 : TForm1;
implementation
uses ldocktree; // <-----------------here
{$R *.lfm}
{ TForm1 }
procedure TForm1.CheckBox1Change(Sender : TObject);
begin
Panel1.DockSite:= True; // When active this causes a AV when you click ont the panel.
end;
end.
Edit: Lazarus 4.0