Cocoa: fix the issue that ShowBalloonHint does not conform to conventions on macOS, issue #41016

This commit is contained in:
rich2014 2024-07-08 20:52:16 +08:00
parent 2b70328d5d
commit 5db9facb32
2 changed files with 11 additions and 2 deletions

View File

@ -139,8 +139,17 @@ begin
end;
class function TCocoaWSCustomTrayIcon.ShowBalloonHint(const ATrayIcon: TCustomTrayIcon): Boolean;
var
nc: NSUserNotificationCenter;
message: NSUserNotification;
begin
Result := False;
Result := True;
message:= NSUserNotification.alloc.init;
message.setTitle( StrToNSString(ATrayIcon.BalloonTitle) );
message.setInformativeText( StrToNSString(ATrayIcon.BalloonHint) );
nc:= NSUserNotificationCenter.defaultUserNotificationCenter;
nc.deliverNotification( message );
message.release;
end;
class function TCocoaWSCustomTrayIcon.GetPosition(const ATrayIcon: TCustomTrayIcon): TPoint;

View File

@ -31,7 +31,7 @@ uses
WSExtCtrls, WSLCLClasses,
// LCL Cocoa
CocoaPrivate, CocoaMenus, CocoaWSCommon, CocoaGDIObjects, CocoaScrollers,
Cocoa_Extra;
Cocoa_Extra, CocoaUtils;
type