mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-17 05:20:48 +01:00
Fixed bug #10622 where Listview.ItemIndex did not exist
git-svn-id: trunk@22909 -
This commit is contained in:
parent
ffcb9ab6f3
commit
b88059e19b
@ -1030,6 +1030,7 @@ type
|
|||||||
function GetFocused: TListItem;
|
function GetFocused: TListItem;
|
||||||
function GetImageList(const ALvilOrd: Integer): TCustomImageList;
|
function GetImageList(const ALvilOrd: Integer): TCustomImageList;
|
||||||
function GetHoverTime: Integer;
|
function GetHoverTime: Integer;
|
||||||
|
function GetItemIndex: Integer;
|
||||||
function GetProperty(const ALvpOrd: Integer): Boolean;
|
function GetProperty(const ALvpOrd: Integer): Boolean;
|
||||||
function GetSelCount: Integer;
|
function GetSelCount: Integer;
|
||||||
function GetSelection: TListItem;
|
function GetSelection: TListItem;
|
||||||
@ -1046,6 +1047,7 @@ type
|
|||||||
procedure SetHoverTime(const AValue: Integer);
|
procedure SetHoverTime(const AValue: Integer);
|
||||||
procedure SetIconOptions(const AValue: TIconOptions);
|
procedure SetIconOptions(const AValue: TIconOptions);
|
||||||
procedure SetImageList(const ALvilOrd: Integer; const AValue: TCustomImageList);
|
procedure SetImageList(const ALvilOrd: Integer; const AValue: TCustomImageList);
|
||||||
|
procedure SetItemIndex(const AValue: Integer);
|
||||||
procedure SetItems(const AValue : TListItems);
|
procedure SetItems(const AValue : TListItems);
|
||||||
procedure SetItemVisible(const AValue: TListItem; const APartialOK: Boolean);
|
procedure SetItemVisible(const AValue: TListItem; const APartialOK: Boolean);
|
||||||
procedure SetOwnerData(const AValue: Boolean);
|
procedure SetOwnerData(const AValue: Boolean);
|
||||||
@ -1144,6 +1146,7 @@ type
|
|||||||
property HotTrackStyles: TListHotTrackStyles read FHotTrackStyles write SetHotTrackStyles default [];
|
property HotTrackStyles: TListHotTrackStyles read FHotTrackStyles write SetHotTrackStyles default [];
|
||||||
property IconOptions: TIconOptions read FIconOptions write SetIconOptions;
|
property IconOptions: TIconOptions read FIconOptions write SetIconOptions;
|
||||||
property ItemFocused: TListItem read GetFocused write SetFocused;
|
property ItemFocused: TListItem read GetFocused write SetFocused;
|
||||||
|
property ItemIndex: Integer read GetItemIndex write SetItemIndex;
|
||||||
property Items: TListItems read FListItems write SetItems;
|
property Items: TListItems read FListItems write SetItems;
|
||||||
// MultiSelect and ReadOnly should be protected, but can't because Carbon Interface
|
// MultiSelect and ReadOnly should be protected, but can't because Carbon Interface
|
||||||
// needs to access this property and it cannot cast to TListItem, because we have
|
// needs to access this property and it cannot cast to TListItem, because we have
|
||||||
@ -1190,6 +1193,7 @@ type
|
|||||||
// property HotTrackStyles;
|
// property HotTrackStyles;
|
||||||
// property HoverTime;
|
// property HoverTime;
|
||||||
property IconOptions;
|
property IconOptions;
|
||||||
|
property ItemIndex;
|
||||||
property Items;
|
property Items;
|
||||||
property LargeImages;
|
property LargeImages;
|
||||||
property MultiSelect;
|
property MultiSelect;
|
||||||
|
|||||||
@ -737,6 +737,14 @@ begin
|
|||||||
else Result := FHoverTime;
|
else Result := FHoverTime;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomListView.GetItemIndex: Integer;
|
||||||
|
begin
|
||||||
|
Result := -1;
|
||||||
|
if Selected = nil then
|
||||||
|
Exit;
|
||||||
|
Result := Selected.Index;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomListView.GetHitTestInfoAt(X, Y: Integer): THitTests;
|
function TCustomListView.GetHitTestInfoAt(X, Y: Integer): THitTests;
|
||||||
begin
|
begin
|
||||||
Result := [];
|
Result := [];
|
||||||
@ -909,6 +917,16 @@ begin
|
|||||||
TWSCustomListViewClass(WidgetSetClass).SetImageList(Self, lvil, AValue);
|
TWSCustomListViewClass(WidgetSetClass).SetImageList(Self, lvil, AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomListView.SetItemIndex(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if (AValue < -1) or (AValue >= Items.Count) then
|
||||||
|
raise Exception.Create(Format('index %d out of bounds',[AValue]));
|
||||||
|
if AValue = -1 then
|
||||||
|
Selected := nil
|
||||||
|
else
|
||||||
|
Selected := Items.Item[AValue];
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TCustomListView SetSelection
|
TCustomListView SetSelection
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
|
|||||||
@ -490,8 +490,8 @@ end;
|
|||||||
* Params *
|
* Params *
|
||||||
* *
|
* *
|
||||||
* Target : The Control that will recieve the message LM_CHANGED *
|
* Target : The Control that will recieve the message LM_CHANGED *
|
||||||
* ItemIndex : Only used by Listviews. The Index of the Item that has *
|
* ItemIndex : Only used by Listviews and CheckBoxes. The Index of *
|
||||||
* changed. *
|
* the Item that has changed. *
|
||||||
* *
|
* *
|
||||||
******************************************************************************}
|
******************************************************************************}
|
||||||
function LCLSendChangedMsg(const Target: TControl; ItemIndex: WPARAM = 0): PtrInt;
|
function LCLSendChangedMsg(const Target: TControl; ItemIndex: WPARAM = 0): PtrInt;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user