내부 MyAppController (MainWindow를) 응용 프로그램은 원래 editRecipeController의 창,있는 NSPanel을 넣어이 코드를 사용
시트 창 내부
[NSApp beginSheet:[editController window] modalForWindow:[self window] modalDelegate:nil didEndSelector:nil contextInfo:nil];
[NSApp runModalForWindow:[editController window]];
// sheet is up here...
[NSApp endSheet: [editController window]];
[[editController window] orderOut:nil];
[[editController window] close];
,로 EditWindow을 시작하기 // 원본 코드 NSPanel, NSTabView가 있습니다. 패널은 마우스를 사용하여 완전히 작동합니다. 그것에는 5 개의 탭 NSTabView가 있습니다. 하나의 탭에는 NSTextField가 있고, 3 개의 탭에는 NSTextView가 있습니다. 다섯 번째에는 NSTableView가 있습니다.
내가 가진 문제이 (가) ArrowKey, 적절한 탭 강조했다을 사용하여 탭으로 탭에서 탐색 사용자 만이되지 않았다가, 즉, "선택"의보기가 표시되지 때, 다음과 같이이었다. 뷰를 표시하는 유일한 방법은 마우스로 탭을 클릭하는 것입니다.
My goal is to have full keyboard support for the NSTabView
내가 따라 NSTabView에 대한 적절한 동작을 얻을 수있었습니다 :. Hillegass '책, 25 장, "시트를
// MyAppController.m - WindowController for mainWindow
- (IBAction) editRecipeAction:(id)sender {
// setup the edit sheet controller if one hasn't been setup already
if (editRecipeController == nil){
editRecipeController = [[EditRecipeController alloc] initWithWindowNibName:@"EditRecipe"];
//[editRecipeController setMyAppController:self];
}
[[NSApplication sharedApplication] beginSheet:editRecipeController.window
modalForWindow:self.window
modalDelegate:editRecipeController
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:nil];
}
// 끝 MyAppController.m
// EditRecipeController.m
- (IBAction)cancel:(id)sender
{
[NSApp endSheet:self.window returnCode:0 ] ;
[self.window orderOut:self];
}
- (void) sheetDidEnd:(NSWindow *) sheet returnCode:(int)returnCode contextInfo:(void *) contextInfo {
DLog(@"sheet=%@",sheet);
}
목표가 완전 키보드 지원이면
- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem{
NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
[f setNumberStyle:NSNumberFormatterDecimalStyle ];
NSNumber *tabNumber =
[f numberFromString:tabViewItem.identifier];
[f release];
switch (tabNumber.integerValue) {
case 1:
editRecipeController.tabView.nextKeyView = editRecipeController.textViewIngredients;
editRecipeController.textViewIngredients.nextKeyView = editRecipeController.cancelButton;
editRecipeController.cancelButton.nextKeyView = editRecipeController.doneButton;
editRecipeController.doneButton.nextKeyView = editRecipeController.tabView;
break;
case 2:
editRecipeController.tabView.nextKeyView = editRecipeController.textViewDirections;
editRecipeController.textViewDirections.nextKeyView = editRecipeController.cancelButton;
editRecipeController.cancelButton.nextKeyView = editRecipeController.doneButton;
editRecipeController.doneButton.nextKeyView = editRecipeController.tabView;
break;
case 3:
editRecipeController.tabView.nextKeyView = editRecipeController.textViewDirections;
editRecipeController.textViewDirections.nextKeyView = editRecipeController.cancelButton;
editRecipeController.cancelButton.nextKeyView = editRecipeController.doneButton;
editRecipeController.doneButton.nextKeyView = editRecipeController.tabView;
break;
case 4: // Comments
editRecipeController.tabView.nextKeyView = editRecipeController.textViewComments;
editRecipeController.textViewComments.nextKeyView = editRecipeController.cancelButton;
editRecipeController.cancelButton.nextKeyView = editRecipeController.doneButton;
editRecipeController.doneButton.nextKeyView = editRecipeController.tabView;
break;
case 5: //Categories - Table can not be edited
editRecipeController.tabView.nextKeyView = editRecipeController.cancelButton;
editRecipeController.cancelButton.nextKeyView = editRecipeController.doneButton;
editRecipeController.doneButton.nextKeyView = editRecipeController.tabView;
break;
default:
DLog(@"switch value error");
break;
}// end switch
}
: 등이 NSTabView, 나는 당신이 NSTabViewDelegate 방법의 다음 사용 같은 것을 가 필요합니다 생각