• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Text field focus problem.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text field focus problem.


  • Subject: Text field focus problem.
  • From: Chip Howland <email@hidden>
  • Date: Fri, 25 Oct 2013 17:17:49 -0500

I am trying to enable a button when the user clicks in a text field. It is unclear to me what the best way to accomplish this is. However, after a lot of reading, I decided to make a subclass of NSTextView to use becomeFirstResponder as described here:

http://macscripter.net/viewtopic.php?id=37078

This was the result:

script ImageField
    property parent : class "NSTextField"
    property imageSearchButton : missing value

    on becomeFirstResponder()
        -- enable the appropriate button
        imageSearchButton's setEnabled_(true)

        return 1
    end becomeFirstResponder

end script

The text field runs the becomeFirstResponder handler when clicked, but enabling the button fails, because imageSearchButton is null. This is despite the fact that it is bound correctly in Interface Builder.

This code inside of the same subclass correctly logs imageSearchButton:

on testButtonClicked_(sender)
    log imageSearchButton
end testButtonClicked_

If anyone has any idea what I am missing here, or has a better method to achieve the same end result, I would appreciate it.

This project is using Xcode 3.2.6 in Lion.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Prev by Date: Re: Mavericks
  • Next by Date: Re: Text field focus problem
  • Previous by thread: Re: Mavericks
  • Next by thread: Re: Text field focus problem
  • Index(es):
    • Date
    • Thread