mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-06 11:26:00 +02:00
lcl: TCustomList.ItemHeight must return correct value if our ListBox has non-variable item heights
git-svn-id: trunk@16978 -
This commit is contained in:
parent
294989aa80
commit
cd1987af7a
@ -389,7 +389,13 @@ end;
|
|||||||
|
|
||||||
function TCustomListBox.GetItemHeight: Integer;
|
function TCustomListBox.GetItemHeight: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FItemHeight;
|
if HandleAllocated and (Style <> lbOwnerDrawVariable) then
|
||||||
|
begin
|
||||||
|
with ItemRect(TopIndex) do
|
||||||
|
Result := Bottom - Top;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := FItemHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomListBox.SetItemHeight(Value: Integer);
|
procedure TCustomListBox.SetItemHeight(Value: Integer);
|
||||||
@ -696,17 +702,16 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCustomListBox.ItemRect(Index: Integer): TRect;
|
function TCustomListBox.ItemRect(Index: Integer): TRect;
|
||||||
begin
|
begin
|
||||||
if (Index>=0) and (Index<Items.Count) then
|
FillChar(Result, SizeOf(Result), 0);
|
||||||
begin
|
if not HandleAllocated then
|
||||||
TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index, Result);
|
Exit;
|
||||||
end else
|
if (Index >= 0) and (Index < Items.Count) then
|
||||||
|
TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index, Result)
|
||||||
|
else
|
||||||
if (Index=Items.Count) and (Index>0) then
|
if (Index=Items.Count) and (Index>0) then
|
||||||
begin
|
begin
|
||||||
TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index - 1, Result);
|
TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index - 1, Result);
|
||||||
OffsetRect(Result,0,Result.Bottom-Result.Top);
|
OffsetRect(Result, 0, Result.Bottom - Result.Top);
|
||||||
end else
|
|
||||||
begin
|
|
||||||
FillChar(Result,SizeOf(Result),0);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user