mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-15 03:49:26 +02:00
LCL: TCustomListView OwnerData - fix selection behaviour. part of #18202
git-svn-id: trunk@35257 -
This commit is contained in:
parent
a4c49e19cd
commit
5504dab625
@ -933,6 +933,7 @@ type
|
||||
procedure SetTop(Value: Integer);
|
||||
protected
|
||||
function IsEqual(const AItem: TListItem): Boolean;
|
||||
function IsOwnerData: Boolean; virtual;
|
||||
function GetCheckedInternal: Boolean;
|
||||
function GetOwner: TPersistent; override;
|
||||
public
|
||||
@ -979,6 +980,8 @@ type
|
||||
procedure SetImageIndex(const AValue: TImageIndex); override;
|
||||
function GetSubItems: TStrings; override;
|
||||
procedure DoCacheItem;
|
||||
protected
|
||||
function IsOwnerData: Boolean; override;
|
||||
public
|
||||
procedure SetDataIndex(ADataIndex: Integer);
|
||||
procedure SetOwner(AOwner: TListItems);
|
||||
|
@ -487,12 +487,8 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
function TListItem.WSUpdateAllowed: Boolean;
|
||||
begin
|
||||
Result :=
|
||||
( (FFlags * [lifDestroying, lifCreated] = [lifCreated]) or
|
||||
((FFlags = []) and (FOwner <> nil) and (FOwner.FOwner <> nil) and
|
||||
(FOwner.FOwner.OwnerData)) )
|
||||
and (FOwner <> nil)
|
||||
and FOwner.WSUpdateAllowed;
|
||||
Result := (FFlags * [lifDestroying, lifCreated] = [lifCreated]) and
|
||||
(FOwner <> nil) and FOwner.WSUpdateAllowed;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -505,6 +501,11 @@ begin
|
||||
and (FStates = AItem.FStates);
|
||||
end;
|
||||
|
||||
function TListItem.IsOwnerData: Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TListItem GetCheckedInternal }
|
||||
{------------------------------------------------------------------------------}
|
||||
@ -730,7 +731,7 @@ begin
|
||||
then Include(FStates, AState)
|
||||
else Exclude(FStates, AState);
|
||||
|
||||
if not WSUpdateAllowed then Exit;
|
||||
if not WSUpdateAllowed and not IsOwnerData then Exit;
|
||||
LV := FOwner.FOwner;
|
||||
TWSCustomListViewClass(LV.WidgetSetClass).ItemSetState(LV, GetIndex, Self, AState, AIsSet);
|
||||
end;
|
||||
@ -834,3 +835,8 @@ begin
|
||||
FOwner.FOwner.DoGetOwnerData(Self);
|
||||
end;
|
||||
|
||||
function TOwnerDataListItem.IsOwnerData: Boolean;
|
||||
begin
|
||||
Result := (FOwner <> nil) and FOwner.WSUpdateAllowed;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user