mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Disable "Add Folder" button when the text field is empty
This commit is contained in:
@@ -10,10 +10,11 @@ import AppKit
|
||||
import Articles
|
||||
import Account
|
||||
|
||||
class AddFolderWindowController : NSWindowController {
|
||||
class AddFolderWindowController : NSWindowController, NSTextFieldDelegate {
|
||||
|
||||
@IBOutlet var folderNameTextField: NSTextField!
|
||||
@IBOutlet var accountPopupButton: NSPopUpButton!
|
||||
@IBOutlet var addFolderButton: NSButton!
|
||||
var hostWindow: NSWindow?
|
||||
|
||||
convenience init() {
|
||||
@@ -86,5 +87,12 @@ class AddFolderWindowController : NSWindowController {
|
||||
|
||||
hostWindow!.endSheet(window!, returnCode: NSApplication.ModalResponse.OK)
|
||||
}
|
||||
|
||||
|
||||
// MARK: Text Field Delegate
|
||||
|
||||
func controlTextDidChange(_ obj: Notification) {
|
||||
if let value = (obj.object as? NSTextField)?.stringValue {
|
||||
addFolderButton.isEnabled = !value.isEmpty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user