mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-11 10:00:36 +01:00
LCL: In ValueListEditor, allow setting keyAdd in KeyOptions before setting keyEdit. Allow setting goAutoAddRows in Options.
git-svn-id: trunk@44629 -
This commit is contained in:
parent
e8e145a617
commit
0e356292c6
@ -128,6 +128,7 @@ type
|
|||||||
FOnValidate: TOnValidateEvent;
|
FOnValidate: TOnValidateEvent;
|
||||||
FRowTextOnEnter: TKeyValuePair;
|
FRowTextOnEnter: TKeyValuePair;
|
||||||
FLastEditedRow: Integer;
|
FLastEditedRow: Integer;
|
||||||
|
FUpdatingKeyOptions: Boolean;
|
||||||
function GetFixedRows: Integer;
|
function GetFixedRows: Integer;
|
||||||
function GetItemProp(const AKeyOrIndex: Variant): TItemProp;
|
function GetItemProp(const AKeyOrIndex: Variant): TItemProp;
|
||||||
procedure SetFixedRows(AValue: Integer);
|
procedure SetFixedRows(AValue: Integer);
|
||||||
@ -139,10 +140,10 @@ type
|
|||||||
function GetValue(const Key: string): string;
|
function GetValue(const Key: string): string;
|
||||||
procedure SetDisplayOptions(const AValue: TDisplayOptions);
|
procedure SetDisplayOptions(const AValue: TDisplayOptions);
|
||||||
procedure SetDropDownRows(const AValue: Integer);
|
procedure SetDropDownRows(const AValue: Integer);
|
||||||
procedure SetKeyOptions({const} AValue: TKeyOptions);
|
procedure SetKeyOptions(AValue: TKeyOptions);
|
||||||
procedure SetKey(Index: Integer; const Value: string);
|
procedure SetKey(Index: Integer; const Value: string);
|
||||||
procedure SetValue(const Key: string; AValue: string);
|
procedure SetValue(const Key: string; AValue: string);
|
||||||
procedure SetOptions({const} AValue: TGridOptions);
|
procedure SetOptions(AValue: TGridOptions);
|
||||||
procedure SetStrings(const AValue: TValueListStrings);
|
procedure SetStrings(const AValue: TValueListStrings);
|
||||||
procedure SetTitleCaptions(const AValue: TStrings);
|
procedure SetTitleCaptions(const AValue: TStrings);
|
||||||
protected
|
protected
|
||||||
@ -1004,26 +1005,33 @@ begin
|
|||||||
// ToDo: If edit list for inplace editing is implemented, set its handler, too.
|
// ToDo: If edit list for inplace editing is implemented, set its handler, too.
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TValueListEditor.SetKeyOptions({const} AValue: TKeyOptions);
|
procedure TValueListEditor.SetKeyOptions(AValue: TKeyOptions);
|
||||||
begin
|
begin
|
||||||
|
FUpdatingKeyOptions := True;
|
||||||
// KeyAdd requires KeyEdit, KeyAdd oddly enough does not according to Delphi specs
|
// KeyAdd requires KeyEdit, KeyAdd oddly enough does not according to Delphi specs
|
||||||
if (KeyAdd in AValue) and not (KeyEdit in AValue) then AValue := AValue - [KeyAdd];
|
if KeyAdd in AValue then
|
||||||
|
Include(AValue, keyEdit);
|
||||||
FKeyOptions := AValue;
|
FKeyOptions := AValue;
|
||||||
if (KeyAdd in FKeyOptions) then
|
if (KeyAdd in FKeyOptions) then
|
||||||
Options := Options + [goAutoAddRows]
|
Options := Options + [goAutoAddRows]
|
||||||
else
|
else
|
||||||
Options := Options - [goAutoAddRows];
|
Options := Options - [goAutoAddRows];
|
||||||
|
FUpdatingKeyOptions := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TValueListEditor.SetOptions(AValue: TGridOptions);
|
||||||
procedure TValueListEditor.SetOptions({const} AValue: TGridOptions);
|
|
||||||
begin
|
begin
|
||||||
//cannot allow goColMoving
|
//cannot allow goColMoving
|
||||||
if (goColMoving in AValue) then AValue := AValue - [goColMoving];
|
if goColMoving in AValue then
|
||||||
if (goAutoAddRows in AValue) and not (KeyAdd in KeyOptions) then AValue := AValue - [goAutoAddRows];
|
Exclude(AValue, goColMoving);
|
||||||
//temporarily disable this, it causes crashes
|
//temporarily disable this, it causes crashes
|
||||||
if (goAutoAddRowsSkipContentCheck in AValue) then AValue := AValue - [goAutoAddRowsSkipContentCheck];
|
if (goAutoAddRowsSkipContentCheck in AValue) then
|
||||||
|
Exclude(AValue, goAutoAddRowsSkipContentCheck);
|
||||||
inherited Options := AValue;
|
inherited Options := AValue;
|
||||||
|
// Enable also the required KeyOptions for goAutoAddRows
|
||||||
|
if not FUpdatingKeyOptions and not (csLoading in ComponentState)
|
||||||
|
and (goAutoAddRows in AValue) then
|
||||||
|
KeyOptions := KeyOptions + [keyEdit, keyAdd];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TValueListEditor.SetStrings(const AValue: TValueListStrings);
|
procedure TValueListEditor.SetStrings(const AValue: TValueListStrings);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user