mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 08:09:22 +02:00
LCL: don't call LB_GETITEMRECT from LM_MEASUREITEM handler (issue #39653)
This commit is contained in:
parent
e931147ff2
commit
1161c4a75a
@ -339,13 +339,15 @@ var
|
|||||||
begin
|
begin
|
||||||
with TheMessage.MeasureItemStruct^ do
|
with TheMessage.MeasureItemStruct^ do
|
||||||
begin
|
begin
|
||||||
if Self.ItemHeight <> 0 then
|
// don't call GetItemHeight: causes errors on Windows due to recursion on control creation
|
||||||
AHeight := Self.ItemHeight
|
if FItemHeight <> 0 then
|
||||||
|
AHeight := FItemHeight
|
||||||
else begin
|
else begin
|
||||||
Canvas.Font := Font;
|
Canvas.Font := Font;
|
||||||
AHeight := Canvas.TextHeight('Hg');
|
AHeight := Canvas.TextHeight('Hg');
|
||||||
end;
|
end;
|
||||||
MeasureItem(Integer(ItemId), AHeight);
|
if FStyle = lbOwnerDrawVariable then
|
||||||
|
MeasureItem(Integer(ItemId), AHeight);
|
||||||
if AHeight > 0 then
|
if AHeight > 0 then
|
||||||
ItemHeight := AHeight;
|
ItemHeight := AHeight;
|
||||||
end;
|
end;
|
||||||
|
@ -853,15 +853,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class function TWin32WSCustomListBox.GetItemRect(
|
class function TWin32WSCustomListBox.GetItemRect(
|
||||||
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
|
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean;
|
||||||
): boolean;
|
|
||||||
var
|
|
||||||
Handle: HWND;
|
|
||||||
begin
|
begin
|
||||||
Handle := ACustomListBox.Handle;
|
Result := Windows.SendMessage(ACustomListBox.Handle, LB_GETITEMRECT, Index, LPARAM(@ARect)) <> LB_ERR;
|
||||||
// The check for GetProp is required because of some division error which happens
|
|
||||||
// if call LB_GETITEMRECT on window initialization
|
|
||||||
Result := Assigned(GetProp(Handle, 'WinControl')) and (Windows.SendMessage(Handle, LB_GETITEMRECT, Index, LPARAM(@ARect)) <> LB_ERR);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TWin32WSCustomListBox.GetScrollWidth(const ACustomListBox: TCustomListBox): Integer;
|
class function TWin32WSCustomListBox.GetScrollWidth(const ACustomListBox: TCustomListBox): Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user