mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 18:19:08 +02:00
carbon: fix selecting an item in a TListView on Carbon when OwnerDraw is true.patch by Joost van der Sluis. issue #25274
git-svn-id: trunk@43384 -
This commit is contained in:
parent
a5b518939b
commit
cd29849872
@ -134,6 +134,7 @@ type
|
|||||||
Data: DataBrowserItemDataRef; ASetValue: Boolean): OSStatus; virtual;
|
Data: DataBrowserItemDataRef; ASetValue: Boolean): OSStatus; virtual;
|
||||||
procedure NotificationCallBack(ID: DataBrowserItemId;
|
procedure NotificationCallBack(ID: DataBrowserItemId;
|
||||||
AMessage: DataBrowserItemNotification); virtual;
|
AMessage: DataBrowserItemNotification); virtual;
|
||||||
|
function IsIndexOutOfRange(ID: DataBrowserItemId): boolean; virtual;
|
||||||
|
|
||||||
public
|
public
|
||||||
procedure BoundsChanged; override;
|
procedure BoundsChanged; override;
|
||||||
@ -235,6 +236,7 @@ type
|
|||||||
function GetReadOnly: Boolean; override;
|
function GetReadOnly: Boolean; override;
|
||||||
function MultiSelect: Boolean; override;
|
function MultiSelect: Boolean; override;
|
||||||
function IsOwnerDrawn: Boolean; override;
|
function IsOwnerDrawn: Boolean; override;
|
||||||
|
function IsIndexOutOfRange(ID: DataBrowserItemId): boolean; override;
|
||||||
public
|
public
|
||||||
constructor Create(const AObject: TWinControl; const AParams: TCreateParams);
|
constructor Create(const AObject: TWinControl; const AParams: TCreateParams);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -819,7 +821,8 @@ begin
|
|||||||
FItemIndex := -1;
|
FItemIndex := -1;
|
||||||
|
|
||||||
FItemsCheck := TList.Create;
|
FItemsCheck := TList.Create;
|
||||||
|
NotifySelectionChange := True;
|
||||||
|
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1165,7 +1168,7 @@ end;
|
|||||||
procedure TCarbonDataBrowser.NotificationCallBack(ID: DataBrowserItemId;
|
procedure TCarbonDataBrowser.NotificationCallBack(ID: DataBrowserItemId;
|
||||||
AMessage: DataBrowserItemNotification);
|
AMessage: DataBrowserItemNotification);
|
||||||
begin
|
begin
|
||||||
if (ID < 1) or (ID > DataBrowserItemId(GetItemsCount)) then Exit;
|
if IsIndexOutOfRange(ID) then Exit;
|
||||||
|
|
||||||
if NotifySelectionChange then
|
if NotifySelectionChange then
|
||||||
case AMessage of
|
case AMessage of
|
||||||
@ -1180,6 +1183,11 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCarbonDataBrowser.IsIndexOutOfRange(ID: DataBrowserItemId): boolean;
|
||||||
|
begin
|
||||||
|
result := (ID < 1) or (ID > DataBrowserItemId(GetItemsCount));
|
||||||
|
end;
|
||||||
|
|
||||||
function TCarbonDataBrowser.GetTopItem: Integer;
|
function TCarbonDataBrowser.GetTopItem: Integer;
|
||||||
begin
|
begin
|
||||||
Result := GetItemAt(0, GetHeaderHeight);
|
Result := GetItemAt(0, GetHeaderHeight);
|
||||||
@ -1273,7 +1281,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCarbonDataBrowser.SetItemState(AIndex: Integer;
|
procedure TCarbonDataBrowser.SetItemState(AIndex: Integer;
|
||||||
AState: TListItemState; AIsSet: BooleaN);
|
AState: TListItemState; AIsSet: Boolean);
|
||||||
begin
|
begin
|
||||||
case AState of
|
case AState of
|
||||||
lisFocused:
|
lisFocused:
|
||||||
@ -1620,6 +1628,14 @@ begin
|
|||||||
Result := False; // TODO
|
Result := False; // TODO
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCarbonListView.IsIndexOutOfRange(ID: DataBrowserItemId): boolean;
|
||||||
|
begin
|
||||||
|
if not FOwnerData then
|
||||||
|
Result:=inherited IsIndexOutOfRange(ID)
|
||||||
|
else
|
||||||
|
result := (ID < 1 ) or (ID > TListView(LCLObject).Items.Count);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TCarbonListView.Create(const AObject: TWinControl;
|
constructor TCarbonListView.Create(const AObject: TWinControl;
|
||||||
const AParams: TCreateParams);
|
const AParams: TCreateParams);
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user