Created
January 23, 2011 01:11
-
-
Save mikecsh/791710 to your computer and use it in GitHub Desktop.
Sheet display issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* AppController.j | |
* SheetGetsStuck | |
* | |
* Created by You on January 23, 2011. | |
* Copyright 2011, Your Company All rights reserved. | |
*/ | |
@import <Foundation/CPObject.j> | |
@implementation AppController : CPObject | |
{ | |
var _feedbackSheet; | |
var _window; | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask], | |
contentView = [theWindow contentView]; | |
_window = theWindow; | |
[CPMenu setMenuBarVisible:YES]; | |
var submitButton = [[CPButton alloc] initWithFrame:CGRectMake(100,100,200,24)]; | |
[submitButton setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; | |
[submitButton setCenter:[contentView center]]; | |
[submitButton setTitle:"Show Sheet"]; | |
[submitButton setTarget:self]; | |
[submitButton setAction:@selector(showFeedbackSheet:)]; | |
[submitButton setKeyEquivalent:CPCarriageReturnCharacter]; | |
[contentView addSubview:submitButton]; | |
_feedbackSheet = [[CPWindow alloc] initWithContentRect:CGRectMake(0,0,300,400) styleMask:CPDocModalWindowMask]; | |
var contentView = [_feedbackSheet contentView]; | |
var cancelButton = [[CPButton alloc] initWithFrame:CGRectMake(50, 371, 120, 24)]; | |
[cancelButton setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin]; | |
[cancelButton setTitle:"Cancel"]; | |
[cancelButton setTarget:self]; | |
[cancelButton setAction:@selector(dismissSettingsSheet:)]; | |
[cancelButton setKeyEquivalent:CPEscapeFunctionKey]; | |
[contentView addSubview:cancelButton]; | |
[theWindow orderFront:self]; | |
} | |
- (void)showFeedbackSheet:(id)sender | |
{ | |
[CPApp beginSheet:_feedbackSheet modalForWindow:_window modalDelegate:self didEndSelector:nil contextInfo:nil]; | |
} | |
- (void)dismissSettingsSheet:(id)sender | |
{ | |
[CPApp endSheet:_feedbackSheet]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment