我想用右箭头和左箭头模拟选项卡和移位选项卡。我想我必须继承 NSTableview 并覆盖 keydown 代码,但我不知道如何告诉表格视图必须编辑列和行中的单元格。这就是我能走多远
-(void)keyDown:(NSEvent*)event{
[super keyDown:event];
NSLog(@"%hi", [event keyCode]);
if ([event keyCode] == 48 && ([event modifierFlags] &
NSShiftKeyMask)){
[[self window] selectKeyViewPrecedingView:self];
}
if ([event keyCode] == 51){
[[self window] selectKeyViewPrecedingView:self];
}
if ([event keyCode] == 124){
if ([self selectedColumn] < [self numberOfColumns]-1) {
[self performClickOnCellAtColumn:[self selectedColumn]+1 row:[self selectedRow]];
}
}
if ([event keyCode] == 124){
if ([self selectedColumn] > 0) {
[self performClickOnCellAtColumn:[self selectedColumn]-1 row:[self selectedRow]];
}
}
}