Cocoa: make sure to update HintWindow by Invalidate

there is a bug in the implementation before, and the content of HintWindow may not be updated.
when the content of HintWindow has changed, but the size of TCocoaWindowContent has not changed, Cocoa did not update TCocoaWindowContentDocument, so THintWindow.Paint() was not called.
This commit is contained in:
rich2014 2023-08-04 22:51:23 +08:00
parent 70c4c85414
commit 4d033a9af6

View File

@ -316,18 +316,7 @@ class procedure TCocoaWSHintWindow.SetText(const AWinControl: TWinControl;
const AText: String);
begin
TCocoaWSCustomForm.SetText(AWinControl, AText);
//todo: this is a workaround. For some reason, when moving a hint window
// from one control to another (of the same type), the contents
// of the hint window is not invalidated.
//
// Need to figure out why this is happening and resolve at the proper place.
// In the mean time - invalidating contents every time Caption is change
if (AWinControl.HandleAllocated) then
{$ifdef BOOLFIX}
NSView(AWinControl.Handle).setNeedsDisplay__(Ord(true));
{$else}
NSView(AWinControl.Handle).setNeedsDisplay_(true);
{$endif}
AWinControl.Invalidate;
end;
{ TLCLWindowCallback }