Thanks Chuck for the quick reply. I am having a new problem now. my contextual menu is getting displayed but the menu items are not activated. so my new code for displaying the menu is as follows:
NSMenu *defMenu = [[[NSMenu alloc] initWithTitle:@"default Contextual Menu"] autorelease];
[defMenu insertItemWithTitle:@"Open" action:@selector(openFile) keyEquivalent:@"" atIndex:0];
[defMenu insertItemWithTitle:@"Delete" action:@selector(deleteFile) keyEquivalent:@"" atIndex:1];
return defMenu;
and function declaratons of deleteFile and openFile are as follows:
-(int)openFile;
-(int)deleteFile;
and i am calling my contextual menu as follows:
-(void)doSingleClick {
if([[NSApp currentEvent] modifierFlags] & NSControlKeyMask)
{
NSLog(@"control clicked.......");
[NSMenu popUpContextMenu:[self defaultMenu] withEvent:[NSApp currentEvent] forView:tableView];
return;
}
}
my contextual menu items are all shaded and cannot be clicked. Please can you tell where i am going wrong.
Thanks