Files
cappuccino/Tests/Manual/KeyViewLoopTest/AppController.j
T
Aparajita Fishman af2e0348c1 More key view loop madness
- It turns out Cocoa DOES recalculate the loop when calling recalculateKeyViewLoop. It does not wait until selectNext/PreviousKeyView is called.
- Cocoa calculates the key view loop for nibs that do not have one, but does not call recalculateKeyViewLoop.
- If there is no first responder and no initial first responder when a window first becomes key, use the first valid key view, not the first geometric key view.
- Made allViews function a method, not sure why it was a function.
- Unit tests now pass.
2013-01-10 09:11:58 +07:00

45 lines
861 B
Plaintext

/*
* AppController.j
* KeyViewLoopTest
*
* Created by You on January 7, 2013.
* Copyright 2013, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
@outlet CPWindow keyWindow;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
[keyWindow makeKeyAndOrderFront:self];
}
@end
@implementation MyWindow : CPWindow
- (@action)addField:(id)sender
{
var field = [CPTextField textFieldWithStringValue:@"" placeholder:@"" width:96];
[field setFrameOrigin:CGPointMake(43, 135)];
[[self contentView] addSubview:field];
[sender setEnabled:NO];
[self makeFirstResponder:[[self contentView] viewWithTag:1]];
}
- (@action)recalc:(id)sender
{
[self recalculateKeyViewLoop];
[self makeFirstResponder:[[self contentView] viewWithTag:1]];
}
@end