I want to trigger the right click on statusitem i am able to trigger left click but not right click .
-(void)applicationWillFinishLaunching:(NSNotification *)notification{
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
[statusItem setTitle:@"Coverdesk"];
[statusItem setEnabled:YES];
[statusItem setAction:@selector(handleStatusItemActions:)];
[statusItem setTarget:self];
[[MenuHandler defaultHandler].menu setDelegate:self];
[MenuHandler defaultHandler].delegate = self;
[statusItem setHighlightMode:YES];}
-(void)handleStatusItemActions:(id)sender{
if ([[NSUserDefaults standardUserDefaults] boolForKey:kUDKeyMouseClickPrefrence]) {
NSEvent *event = [NSApp currentEvent];
if(event.type == NSEventTypeLeftMouseUp) {
NSLog(@"left");
[self showWindow];
}
else if(event.type == NSEventTypeRightMouseUp) {
NSLog(@"right");
[self showMenu];
}
}else{
NSLog(@"main menu");
[self showMenu];
} }
Above code which i am using.
Any suggestion?
Thanks in Advance !