How to connect the OS X dictionary

on osx lion, you can control-command-d or triple-click on the word your mouse is pointing to in any application to launch the popover dictionary. I want to make an application for tracking words that a user is looking for in a dictionary.

how can I observe an event when the user executes the control-command-d command or triple-click to start the popover dictionary?

I understand the specific API for this HIDictionaryWindowShow .

+6
source share
1 answer

You can use popoverDidShow:

- (void)awakeFromNib { NSNotificationCenter* notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver:self selector:@selector(popoverDidShow:) name:NSPopoverDidShowNotification object:nil]; } // dictionary is shown or another NSPopover - (void)popoverDidShow:(NSNotification*)notify { //your code } 
+3
source

Source: https://habr.com/ru/post/919068/


All Articles