LCL: Don't publish FixedRows in ValueListEditor, allow only 0 or 1. Issue #23430

git-svn-id: trunk@39441 -
This commit is contained in:
juha 2012-12-05 13:27:01 +00:00
parent cbb7efe4ae
commit 64b47ff313

View File

@ -48,6 +48,8 @@ type
FOnStringsChange: TNotifyEvent; FOnStringsChange: TNotifyEvent;
FOnStringsChanging: TNotifyEvent; FOnStringsChanging: TNotifyEvent;
FOnValidate: TOnValidateEvent; FOnValidate: TOnValidateEvent;
function GetFixedRows: Integer;
procedure SetFixedRows(AValue: Integer);
procedure StringsChange(Sender: TObject); procedure StringsChange(Sender: TObject);
procedure StringsChanging(Sender: TObject); procedure StringsChanging(Sender: TObject);
function GetOptions: TGridOptions; function GetOptions: TGridOptions;
@ -77,6 +79,7 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
property FixedRows: Integer read GetFixedRows write SetFixedRows default 1;
property Modified; property Modified;
property Keys[Index: Integer]: string read GetKey write SetKey; property Keys[Index: Integer]: string read GetKey write SetKey;
property Values[const Key: string]: string read GetValue write SetValue; property Values[const Key: string]: string read GetValue write SetValue;
@ -92,8 +95,6 @@ type
property BorderSpacing; property BorderSpacing;
property BorderStyle; property BorderStyle;
property Color; property Color;
//property ColCount;
//property Columns;
property Constraints; property Constraints;
property DefaultColWidth; property DefaultColWidth;
property DefaultDrawing; property DefaultDrawing;
@ -105,7 +106,6 @@ type
property ExtendedSelect; property ExtendedSelect;
property FixedColor; property FixedColor;
property FixedCols; property FixedCols;
property FixedRows;
property Flat; property Flat;
property Font; property Font;
property GridLineWidth; property GridLineWidth;
@ -190,8 +190,7 @@ type
property Strings: TValueListStrings read FStrings write SetStrings; property Strings: TValueListStrings read FStrings write SetStrings;
property TitleCaptions: TStrings read FTitleCaptions write SetTitleCaptions; property TitleCaptions: TStrings read FTitleCaptions write SetTitleCaptions;
property OnEditButtonClick: TNotifyEvent read FOnEditButtonClick property OnEditButtonClick: TNotifyEvent read FOnEditButtonClick write SetOnEditButtonClick;
write SetOnEditButtonClick;
property OnGetPickList: TGetPickListEvent read FOnGetPickList write FOnGetPickList; property OnGetPickList: TGetPickListEvent read FOnGetPickList write FOnGetPickList;
property OnMouseEnter; property OnMouseEnter;
property OnMouseLeave; property OnMouseLeave;
@ -283,6 +282,21 @@ begin
OnStringsChanging(Self); OnStringsChanging(Self);
end; end;
function TValueListEditor.GetFixedRows: Integer;
begin
Result := inherited FixedRows;
end;
procedure TValueListEditor.SetFixedRows(AValue: Integer);
begin
if AValue in [0,1] then begin // No other values are allowed
if AValue = 0 then // Typically DisplayOptions are changed directly
DisplayOptions := DisplayOptions - [doColumnTitles]
else
DisplayOptions := DisplayOptions + [doColumnTitles]
end;
end;
function TValueListEditor.GetOptions: TGridOptions; function TValueListEditor.GetOptions: TGridOptions;
begin begin
Result := inherited Options; Result := inherited Options;
@ -296,9 +310,9 @@ begin
if doColumnTitles in AValue then begin if doColumnTitles in AValue then begin
if RowCount < 2 then if RowCount < 2 then
inherited RowCount := 2; inherited RowCount := 2;
FixedRows := 1; inherited FixedRows := 1;
end else end else
FixedRows := 0; inherited FixedRows := 0;
FDisplayOptions := AValue; FDisplayOptions := AValue;
ShowColumnTitles; ShowColumnTitles;
AdjustColumnWidths; AdjustColumnWidths;