Created
June 12, 2019 05:10
-
-
Save KevinGutowski/37ac08d9512ab3d324294a6bd6ccd84e to your computer and use it in GitHub Desktop.
Trying to get NSPanel to expand downward.
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
let threadDictionary = NSThread.mainThread().threadDictionary() | |
let panelID = "com.betterTypePanel.panel" | |
if (threadDictionary[panelID]) { | |
let panel = threadDictionary[panelID] | |
panel.close() | |
threadDictionary.removeObjectForKey(panelID) | |
} | |
var panelWidth = 312 | |
var panelHeight = 210 | |
let panel = NSPanel.alloc().init() | |
panel.setFrame_display(NSMakeRect(0, 0, panelWidth, panelHeight), true) | |
panel.setStyleMask(NSTexturedBackgroundWindowMask | NSTitledWindowMask | NSClosableWindowMask) | |
panel.title = "Testing" | |
panel.center() | |
panel.makeKeyAndOrderFront(null) | |
panel.setLevel(NSFloatingWindowLevel) | |
panel.standardWindowButton(NSWindowMiniaturizeButton).setHidden(true) | |
panel.standardWindowButton(NSWindowZoomButton).setHidden(true) | |
threadDictionary[panelID] = panel | |
let x1 = panel.frame().origin.x | |
let y1 = panel.frame().origin.y | |
panel.setFrame_display_animate(NSMakeRect(x1, y1, panelWidth, panelHeight + 50), true, true) | |
// Fix to get panel to animate downward | |
//panel.setFrame_display_animate(NSMakeRect(x1, y1 - 50, panelWidth, panelHeight + 50), true, true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment