implemented TCustomListBox.ItemAtPos

git-svn-id: trunk@5054 -
This commit is contained in:
mattias 2004-01-12 15:04:41 +00:00
parent a9c328fd76
commit 383c1ee5f1
2 changed files with 22 additions and 0 deletions

View File

@ -457,6 +457,24 @@ begin
Result:=GetListBoxIndexAtY(Self, Y);
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;

View File

@ -383,6 +383,7 @@ type
constructor Create(AOwner : TComponent); override;
destructor Destroy; override;
function GetIndexAtY(Y: integer): integer;
function ItemAtPos(const Pos: TPoint; Existing: Boolean): Integer;
function ItemRect(Index: Integer): TRect;
procedure Clear;
public
@ -1467,6 +1468,9 @@ end.
{ =============================================================================
$Log$
Revision 1.116 2004/01/12 15:04:41 mattias
implemented TCustomListBox.ItemAtPos
Revision 1.115 2004/01/11 11:57:54 mattias
implemented TCustomListBox.ItemRect for gtk1 intf