canBecomeMainWindow
メインウインドウになることができるかを返します
@property(readonly) BOOL canBecomeMainWindow
var canBecomeMainWindow: Bool { get }
解説
設定値
BOOL
Bool { get }
フレームワーク
ApplicationKit
クラス
NSWindow
使用可能
参照
関連記事(外部サイト)
例文
//NSWindow canBecomeMainWindow //NSWindow makeMainWindow func buttonAction082(sender: AnyObject){ var aWindow : NSWindow = (sender as NSButton).window! if (aWindow.canBecomeMainWindow){ NSLog("YES") aWindow.makeMainWindow() }else{ NSLog("NO") } } @IBAction func function082(sender: AnyObject) { var theWindow : MyWindow082 = MyWindow082(contentRect: NSMakeRect(0.0, 0.0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false) windowArray.addObject(theWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 theWindow.center()//ウインドウをスクリーンの中心に theWindow.title = "ウインドウタイトル"//タイトル設定 theWindow.orderFront(self)//前面に theWindow.makeKeyAndOrderFront(self)//表示 //ボタンを作成 var theButton : NSButton = NSButton(frame: NSMakeRect(100.0, 2.0, 100.0, 30.0)) theButton.title = "Action" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction082:") theButton.target = self theWindow.contentView.addSubview(theButton) var textField1 : NSTextField = NSTextField(frame: NSMakeRect(100.0, 100.0, 100.0, 30.0)) theWindow.contentView.addSubview(textField1) }
//NSWindow canBecomeMainWindow //NSWindow makeMainWindow func buttonAction082(sender: AnyObject){ var aWindow : NSWindow = (sender as NSButton).window! if (aWindow.canBecomeMainWindow){ NSLog("YES") aWindow.makeMainWindow() }else{ NSLog("NO") } } @IBAction func function082(sender: AnyObject) { var theWindow : MyWindow082 = MyWindow082(contentRect: NSMakeRect(0.0, 0.0, 300, 200), styleMask: NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, backing: .Buffered, defer: false) windowArray.addObject(theWindow) //ウインドウを保持するための配列に追加。アプリ終了時に配列は破棄 theWindow.center()//ウインドウをスクリーンの中心に theWindow.title = "ウインドウタイトル"//タイトル設定 theWindow.orderFront(self)//前面に theWindow.makeKeyAndOrderFront(self)//表示 //ボタンを作成 var theButton : NSButton = NSButton(frame: NSMakeRect(100.0, 2.0, 100.0, 30.0)) theButton.title = "Action" theButton.bezelStyle = NSBezelStyle.RoundedBezelStyle theButton.action = Selector("buttonAction082:") theButton.target = self theWindow.contentView.addSubview(theButton) var textField1 : NSTextField = NSTextField(frame: NSMakeRect(100.0, 100.0, 100.0, 30.0)) theWindow.contentView.addSubview(textField1) }