I writed a code in delphi to insert a status item to an system status bar, the code works good and status item displayed. I used an transparent icon and I should click exactly on icon (not icon rect) to open menu. But if I click on transparent area of icon, nothing happens! I write same code by XCode and every thing is ok.
Is any body has idea for this case? I want to open menu by click on any point of Status Icon (colored and transparent points).
the code:
procedure createStatusItem;
var
app_delg: AppDelegate;
statusBar: NSStatusBar;
statusItem: NSStatusItem;
menu: NSMenu;
pImage: Pointer;
nsImage: NSImage;
begin
app_delg := TAppDelegate.Create;
TNSApplication.Wrap(TNSApplication.OCClass.sharedApplication()).setDelegate(AppDelegate(app_delg));
statusBar := TNSStatusBar.Wrap(TNSStatusBar.OCClass.systemStatusBar);
menu := TNSMenu.Wrap(TNSMenu.Alloc.initWithTitle(NSSTR('')));
statusItem := statusBar.statusItemWithLength(NSVariableStatusItemLength);
statusItem.retain;
statusItem.setHighlightMode(true);
statusItem.setAction(sel_getUid('onMenuClicked:'));
statusItem.setMenu(menu);
pImage := TNSImage.Alloc.initWithContentsOfFile(NSSTR('icon.ico'));
nsImage := TNSImage.Wrap(pImage);
statusItem.setImage(nsImage);
nsImage.release;
end;
Thanks.