mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 17:39:22 +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);
|
procedure SetTop(Value: Integer);
|
||||||
protected
|
protected
|
||||||
function IsEqual(const AItem: TListItem): Boolean;
|
function IsEqual(const AItem: TListItem): Boolean;
|
||||||
|
function IsOwnerData: Boolean; virtual;
|
||||||
function GetCheckedInternal: Boolean;
|
function GetCheckedInternal: Boolean;
|
||||||
function GetOwner: TPersistent; override;
|
function GetOwner: TPersistent; override;
|
||||||
public
|
public
|
||||||
@ -979,6 +980,8 @@ type
|
|||||||
procedure SetImageIndex(const AValue: TImageIndex); override;
|
procedure SetImageIndex(const AValue: TImageIndex); override;
|
||||||
function GetSubItems: TStrings; override;
|
function GetSubItems: TStrings; override;
|
||||||
procedure DoCacheItem;
|
procedure DoCacheItem;
|
||||||
|
protected
|
||||||
|
function IsOwnerData: Boolean; override;
|
||||||
public
|
public
|
||||||
procedure SetDataIndex(ADataIndex: Integer);
|
procedure SetDataIndex(ADataIndex: Integer);
|
||||||
procedure SetOwner(AOwner: TListItems);
|
procedure SetOwner(AOwner: TListItems);
|
||||||
|
@ -487,12 +487,8 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
function TListItem.WSUpdateAllowed: Boolean;
|
function TListItem.WSUpdateAllowed: Boolean;
|
||||||
begin
|
begin
|
||||||
Result :=
|
Result := (FFlags * [lifDestroying, lifCreated] = [lifCreated]) and
|
||||||
( (FFlags * [lifDestroying, lifCreated] = [lifCreated]) or
|
(FOwner <> nil) and FOwner.WSUpdateAllowed;
|
||||||
((FFlags = []) and (FOwner <> nil) and (FOwner.FOwner <> nil) and
|
|
||||||
(FOwner.FOwner.OwnerData)) )
|
|
||||||
and (FOwner <> nil)
|
|
||||||
and FOwner.WSUpdateAllowed;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -505,6 +501,11 @@ begin
|
|||||||
and (FStates = AItem.FStates);
|
and (FStates = AItem.FStates);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TListItem.IsOwnerData: Boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TListItem GetCheckedInternal }
|
{ TListItem GetCheckedInternal }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -730,7 +731,7 @@ begin
|
|||||||
then Include(FStates, AState)
|
then Include(FStates, AState)
|
||||||
else Exclude(FStates, AState);
|
else Exclude(FStates, AState);
|
||||||
|
|
||||||
if not WSUpdateAllowed then Exit;
|
if not WSUpdateAllowed and not IsOwnerData then Exit;
|
||||||
LV := FOwner.FOwner;
|
LV := FOwner.FOwner;
|
||||||
TWSCustomListViewClass(LV.WidgetSetClass).ItemSetState(LV, GetIndex, Self, AState, AIsSet);
|
TWSCustomListViewClass(LV.WidgetSetClass).ItemSetState(LV, GetIndex, Self, AState, AIsSet);
|
||||||
end;
|
end;
|
||||||
@ -834,3 +835,8 @@ begin
|
|||||||
FOwner.FOwner.DoGetOwnerData(Self);
|
FOwner.FOwner.DoGetOwnerData(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TOwnerDataListItem.IsOwnerData: Boolean;
|
||||||
|
begin
|
||||||
|
Result := (FOwner <> nil) and FOwner.WSUpdateAllowed;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user