win32: don't call LB_GETITEMRECT during ListBox initialization (fixes issue #0019191)

git-svn-id: trunk@30377 -
This commit is contained in:
paul 2011-04-19 06:09:26 +00:00
parent bd8eb25ea6
commit fb02700240

View File

@ -668,12 +668,14 @@ begin
Result := SendMessage(ACustomListBox.Handle, LB_GETCURSEL, 0, 0); Result := SendMessage(ACustomListBox.Handle, LB_GETCURSEL, 0, 0);
end; end;
class function TWin32WSCustomListBox.GetItemRect( class function TWin32WSCustomListBox.GetItemRect(const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect): Boolean;
const ACustomListBox: TCustomListBox; Index: integer; var ARect: TRect var
): boolean; Handle: HWND;
begin begin
Result := Windows.SendMessage(ACustomListBox.Handle, LB_GETITEMRECT, Index, Handle := ACustomListBox.Handle;
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 := (GetProp(Handle, 'WinControl') <> 0) 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;