Thanks to Ken & Charles for helping me solve this.
My code now looks like

if makeEditable
        {
        if myTextField.my_isFirstResponder
                {
                myTextField.isEditable.window?.my_commitEditing()
                myTextField.isEditable.window?.selectPreviousKeyView(nil)
                }
        myTextField.isEditable = false
        myTextField.isBezeled = false
        myTextField.drawsBackground = false
        }
else
        {
        myTextField.isEditable = true
        myTextField.isBezeled = true
        myTextField.drawsBackground = true
        }

For a text field my_isFirstResponder (extension on NSView) returns true if it 
is the delegate of the first responder.
my_commitEditing (extension on NSWindow) finds the active text field as the 
delegate of the first responder and calls activeTextField.endEditing( 
currentEditor )

Jan E.
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to