mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 04:19:47 +02:00
LCL: added StoredWidth property to grid column; dispose FWidth if negative width is set. Issue #28959
git-svn-id: trunk@50262 -
This commit is contained in:
parent
99dee96a0a
commit
fa277e1eb3
@ -499,6 +499,7 @@ type
|
||||
function GetMinSize: Integer;
|
||||
function GetSizePriority: Integer;
|
||||
function GetReadOnly: Boolean;
|
||||
function GetStoredWidth: Integer;
|
||||
function GetVisible: Boolean;
|
||||
function GetWidth: Integer;
|
||||
function IsAlignmentStored: boolean;
|
||||
@ -558,6 +559,7 @@ type
|
||||
procedure FillDefaultFont;
|
||||
function IsDefault: boolean; virtual;
|
||||
property Grid: TCustomGrid read GetGrid;
|
||||
property StoredWidth: Integer read GetStoredWidth;
|
||||
property WidthChanged: boolean read FWidthChanged;
|
||||
|
||||
published
|
||||
@ -11381,6 +11383,14 @@ begin
|
||||
result := FReadOnly^;
|
||||
end;
|
||||
|
||||
function TGridColumn.GetStoredWidth: Integer;
|
||||
begin
|
||||
if FWidth=nil then
|
||||
result := -1
|
||||
else
|
||||
result := FWidth^;
|
||||
end;
|
||||
|
||||
function TGridColumn.GetValueChecked: string;
|
||||
begin
|
||||
if FValueChecked = nil then
|
||||
@ -11634,13 +11644,22 @@ procedure TGridColumn.SetWidth(const AValue: Integer);
|
||||
begin
|
||||
if (AValue=0) and not Visible then
|
||||
exit;
|
||||
if FWidth = nil then begin
|
||||
if AValue=GetDefaultWidth then
|
||||
if AValue>0 then begin
|
||||
if FWidth = nil then begin
|
||||
if AValue=GetDefaultWidth then
|
||||
exit;
|
||||
New(FWidth)
|
||||
end else if FWidth^ = AVAlue then
|
||||
exit;
|
||||
New(FWidth)
|
||||
end else if FWidth^ = AVAlue then
|
||||
exit;
|
||||
FWidth^ := AValue;
|
||||
FWidth^ := AValue;
|
||||
end else begin
|
||||
// negative value is handed over - dispose FWidth to use DefaultWidth
|
||||
if FWidth <> nil then begin
|
||||
Dispose(FWidth);
|
||||
FWidth := nil;
|
||||
end else
|
||||
exit;
|
||||
end;
|
||||
FWidthChanged:=true;
|
||||
ColumnChanged;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user