mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 01:59:05 +02:00
lcl: ShellListView, don't use OnResize event, override Resize method
git-svn-id: trunk@22718 -
This commit is contained in:
parent
c8e69ea350
commit
8b5fdfc0d4
@ -144,11 +144,10 @@ type
|
|||||||
procedure SetMask(const AValue: string);
|
procedure SetMask(const AValue: string);
|
||||||
procedure SetShellTreeView(const Value: TCustomShellTreeView);
|
procedure SetShellTreeView(const Value: TCustomShellTreeView);
|
||||||
procedure SetRoot(const Value: string);
|
procedure SetRoot(const Value: string);
|
||||||
{ Other internal methods }
|
|
||||||
procedure HandleResize(Sender: TObject);
|
|
||||||
protected
|
protected
|
||||||
{ Methods specific to Lazarus }
|
{ Methods specific to Lazarus }
|
||||||
procedure PopulateWithRoot();
|
procedure PopulateWithRoot();
|
||||||
|
procedure Resize; override;
|
||||||
public
|
public
|
||||||
{ Basic methods }
|
{ Basic methods }
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@ -536,28 +535,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomShellListView.HandleResize(Sender: TObject);
|
|
||||||
begin
|
|
||||||
{$ifdef DEBUG_SHELLCTRLS}
|
|
||||||
WriteLn(':>TCustomShellListView.HandleResize');
|
|
||||||
{$endif}
|
|
||||||
|
|
||||||
// The correct check is with count,
|
|
||||||
// if Column[0] <> nil then
|
|
||||||
// will raise an exception
|
|
||||||
if Self.Columns.Count < 3 then Exit;
|
|
||||||
|
|
||||||
Column[0].Width := (70 * Width) div 100;
|
|
||||||
Column[1].Width := (15 * Width) div 100;
|
|
||||||
Column[2].Width := (15 * Width) div 100;
|
|
||||||
|
|
||||||
{$ifdef DEBUG_SHELLCTRLS}
|
|
||||||
WriteLn(':<TCustomShellListView.HandleResize C0.Width=',
|
|
||||||
Column[0].Width, ' C1.Width=', Column[1].Width,
|
|
||||||
' C2.Width=', Column[2].Width);
|
|
||||||
{$endif}
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TCustomShellListView.Create(AOwner: TComponent);
|
constructor TCustomShellListView.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
@ -573,10 +550,7 @@ begin
|
|||||||
Self.Column[1].Caption := 'Size';
|
Self.Column[1].Caption := 'Size';
|
||||||
Self.Column[2].Caption := 'Type';
|
Self.Column[2].Caption := 'Type';
|
||||||
// Initial sizes, necessary under Windows CE
|
// Initial sizes, necessary under Windows CE
|
||||||
HandleResize(Self);
|
Resize;
|
||||||
|
|
||||||
// Internal event handlers
|
|
||||||
OnResize := @HandleResize;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCustomShellListView.Destroy;
|
destructor TCustomShellListView.Destroy;
|
||||||
@ -626,6 +600,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomShellListView.Resize;
|
||||||
|
begin
|
||||||
|
inherited Resize;
|
||||||
|
{$ifdef DEBUG_SHELLCTRLS}
|
||||||
|
WriteLn(':>TCustomShellListView.HandleResize');
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
// The correct check is with count,
|
||||||
|
// if Column[0] <> nil then
|
||||||
|
// will raise an exception
|
||||||
|
if Self.Columns.Count < 3 then Exit;
|
||||||
|
|
||||||
|
Column[0].Width := (70 * Width) div 100;
|
||||||
|
Column[1].Width := (15 * Width) div 100;
|
||||||
|
Column[2].Width := (15 * Width) div 100;
|
||||||
|
|
||||||
|
{$ifdef DEBUG_SHELLCTRLS}
|
||||||
|
WriteLn(':<TCustomShellListView.HandleResize C0.Width=',
|
||||||
|
Column[0].Width, ' C1.Width=', Column[1].Width,
|
||||||
|
' C2.Width=', Column[2].Width);
|
||||||
|
{$endif}
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomShellListView.GetPathFromItem(ANode: TListItem): string;
|
function TCustomShellListView.GetPathFromItem(ANode: TListItem): string;
|
||||||
begin
|
begin
|
||||||
Result := IncludeTrailingPathDelimiter(FRoot) + ANode.Caption;
|
Result := IncludeTrailingPathDelimiter(FRoot) + ANode.Caption;
|
||||||
|
Loading…
Reference in New Issue
Block a user