Why doesn’t this code work:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[NSEvent addGlobalMonitorForEventsMatchingMask:(NSScrollWheelMask) handler:^(struct NSEvent *event){
[scrollEvent:event];
}];
}
- (void)scrollEvent:event {
NSLog( @"scroll" );
}
It says “‘scrollEvent’ undeclared”.
I’m just learning objc and cocoa, so I assume this is just a simple error.
Your code appears to have some bugs in it. I’ve cleaned up some, please see below.
To summarize:
NSEvent *, not astruct NSEvent *.Hope that helps and good luck with the program.