Files
cappuccino/Tests/Manual/CPTabViewNib/AppController.j
T
cacaodev 59ce74a3df CPTabView : _selectedIndex was undefined after decoding an empty tab view (no items).
A visible bug was that the first item added was not immediately selected. Updated CPTabViewNib example, shows the bug fixed.
2012-02-10 16:29:50 +01:00

46 lines
1.0 KiB
Plaintext

/*
* AppController.j
* CPTabViewNib
*
* Created by Alexander Ljungberg on November 5, 2010.
* Copyright 2010, WireLoad, LLC All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
@outlet CPTabView nibTabView;
@outlet CPTabView nibTabViewEmpty;
}
- (IBAction)changeView:(id)sender
{
var item = [nibTabView selectedTabViewItem],
view = [[CPView alloc] initWithFrame:CGRectMakeZero()];
[view setBackgroundColor:[CPColor redColor]];
[item setView:view];
}
- (void)awakeFromCib
{
var item = [[CPTabViewItem alloc] initWithIdentifier:@"item"],
view = [[CPView alloc] initWithFrame:CGRectMakeZero()];
[item setView:view];
[item setLabel:@"item"];
[nibTabViewEmpty addTabViewItem:item];
[theWindow setFullBridge:YES];
}
- (void)tabView:(CPTabView)aTabView didSelectTabViewItem:(CPTabViewItem)tabViewItem
{
CPLogConsole(_cmd + [tabViewItem label]);
}
@end