Setting editable on a NSTextField doesn't have any effect
This was because by default when you bind the value of an NSTextField
in Interface Builder it ticks the box Conditionally Sets Editable meaning that the value the text field is bound to sets the editable
property of the text field.
Unticking this box made my original code work.
can't edit NSTextField in sheet at runtime
The view does not absolutely have to have a title bar.
See
Why NSWindow without styleMask:NSTitledWindowMask can not be keyWindow?
Which states: If you want a titleless window to be able to become a key window, you need to create a subclass of NSWindow and override -canBecomeKeyWindow as follows:
- (BOOL)canBecomeKeyWindow {
return YES;
}
This worked for me.
NSBorderlessWindowMask Subview NSTextfield not keybard editable Swift
I found an awesome workaround for this problem:
basically setup at beginning the NSWindow mask as NSTitledWindowMask, when application is loaded, remove set up the new mask NSBorderlessWindowMask
func applicationWillFinishLaunching(notification: NSNotification) {
self.window?.titleVisibility = NSWindowTitleVisibility.Hidden
self.window?.styleMask = NSTitledWindowMask // adds title bar
}
func applicationDidFinishLaunching(aNotification: NSNotification) {
self.window?.makeKeyWindow()
self.window?.becomeKeyWindow()
self.window.setIsVisible(true)
self.window?.styleMask = NSBorderlessWindowMask // removes title bar
}
Related Topics
Crashlytics Doesn't Work with Xcode 10 Beta
How to Dynamically Hide Navigation Back Button in Swiftui
Way to Check If Up or Down Button Is Pressed with Nsstepper
Swiftui Published Updates Not Refreshing
Xcode 6.1 Swift Extensions - Sourcekit Service Crash
Swift: Guard Let and Where - The Priority
Parsing JSON from Url Ends Up with an Error - Swift 5
Swift: Trunc a Floating Number to Show It in a Label
Swiftui Go Back Programmatically from Representable to View
Switch Statement Where Value Is Int But Case Can Contain Array
Swiftui Change on Multilevel Children Published Object Change
Public Default Init in Protocol
Swiftui Map Overlays Without UIviewrepresentable
How to Change The Default Skscene That Displays on Startup
How We Can Read and Write to Same Observableobject in Swiftui
How to Pass Text from Cell to Textview in Another View Controller
Pie Chart Entries Outside Slices Have Different Position Offsets