mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 10:49:16 +02:00
implemented TCustomListBox.ItemAtPos
git-svn-id: trunk@5054 -
This commit is contained in:
parent
a9c328fd76
commit
383c1ee5f1
@ -457,6 +457,24 @@ begin
|
|||||||
Result:=GetListBoxIndexAtY(Self, Y);
|
Result:=GetListBoxIndexAtY(Self, Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
function TCustomListBox.ItemAtPos(const Pos: TPoint; Existing: Boolean
|
||||||
|
): Integer;
|
||||||
|
|
||||||
|
Returns item index at y coordinate (including scrolling)
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TCustomListBox.ItemAtPos(const Pos: TPoint; Existing: Boolean
|
||||||
|
): Integer;
|
||||||
|
begin
|
||||||
|
Result:=GetIndexAtY(Pos.Y);
|
||||||
|
if Existing then begin
|
||||||
|
if Result>=Items.Count then Result:=-1;
|
||||||
|
end else begin
|
||||||
|
if (Result<0) and (Result>Items.Count) and PtInRect(ClientRect,Pos) then
|
||||||
|
Result:=Items.Count;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function TCustomListBox.ItemRect(Index: Integer): TRect;
|
function TCustomListBox.ItemRect(Index: Integer): TRect;
|
||||||
|
|
||||||
|
@ -383,6 +383,7 @@ type
|
|||||||
constructor Create(AOwner : TComponent); override;
|
constructor Create(AOwner : TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function GetIndexAtY(Y: integer): integer;
|
function GetIndexAtY(Y: integer): integer;
|
||||||
|
function ItemAtPos(const Pos: TPoint; Existing: Boolean): Integer;
|
||||||
function ItemRect(Index: Integer): TRect;
|
function ItemRect(Index: Integer): TRect;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
public
|
public
|
||||||
@ -1467,6 +1468,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.116 2004/01/12 15:04:41 mattias
|
||||||
|
implemented TCustomListBox.ItemAtPos
|
||||||
|
|
||||||
Revision 1.115 2004/01/11 11:57:54 mattias
|
Revision 1.115 2004/01/11 11:57:54 mattias
|
||||||
implemented TCustomListBox.ItemRect for gtk1 intf
|
implemented TCustomListBox.ItemRect for gtk1 intf
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user