mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 14:56:13 +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
|
||||
with TheMessage.MeasureItemStruct^ do
|
||||
begin
|
||||
if Self.ItemHeight <> 0 then
|
||||
AHeight := Self.ItemHeight
|
||||
// don't call GetItemHeight: causes errors on Windows due to recursion on control creation
|
||||
if FItemHeight <> 0 then
|
||||
AHeight := FItemHeight
|
||||
else begin
|
||||
Canvas.Font := Font;
|
||||
AHeight := Canvas.TextHeight('Hg');
|
||||
end;
|
||||
MeasureItem(Integer(ItemId), AHeight);
|
||||
if FStyle = lbOwnerDrawVariable then
|
||||
MeasureItem(Integer(ItemId), AHeight);
|
||||
if AHeight > 0 then
|
||||
ItemHeight := AHeight;
|
||||
end;
|
||||
|
@ -853,15 +853,9 @@ begin
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomListBox.GetItemRect(
|
||||
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect
|
||||
): boolean;
|
||||
var
|
||||
Handle: HWND;
|
||||
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): boolean;
|
||||
begin
|
||||
Handle := ACustomListBox.Handle;
|
||||
// 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);
|
||||
Result := Windows.SendMessage(ACustomListBox.Handle, LB_GETITEMRECT, Index, LPARAM(@ARect)) <> LB_ERR;
|
||||
end;
|
||||
|
||||
class function TWin32WSCustomListBox.GetScrollWidth(const ACustomListBox: TCustomListBox): Integer;
|
||||
|
Loading…
Reference in New Issue
Block a user