• 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
Re: NSController, KVC & AppleScript not co-operating
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSController, KVC & AppleScript not co-operating


  • Subject: Re: NSController, KVC & AppleScript not co-operating
  • From: Dustin Voss <email@hidden>
  • Date: Sat, 6 Mar 2004 22:05:46 -0800

On 6 Mar, 2004, at 2:49 PM, Nicholas Shanks wrote:

When I set a parameter in my app via AppleScript, UI elements do not update.

e.g. my app has a checkbox called "Bob is fishing" which is bound to bob.isFishing, and I call the applescript "tell bob to set isFishing to true", the -setIsFishing: method gets called, but the checkbox does not get set in the UI.
"get isFishing of bob" return true.

So you aren't using an intermediate controller? In that case, if you have an object, Bob, with an isFishing method, you should bind the checkbox to the object Bob and the model key path of "fishing", not "bob.isFishing". The model key path starts within the bound object, it should not include the bound object itself. And KVC takes care of the "is" automatically.

Funnily enough, if setIsFishing: calls [self setValue:[NSNumber 0] forKey:fishCaught], the UI updates the text field displaying fish caught.

Also, creating a command "go fishing" which calls setValue:forKey: updates the UI, but if the command sets the variable directly, no UI updates are seen (this is as expected).

Can anyone tell me how to get UI elements bound to NSControllers to update when applescript changes their values?
Do I have to set up a dummy accessor key which sets the value of the real key for every variable in my app? (Yikes!)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: NSController, KVC & AppleScript not co-operating
      • From: Scott Anguish <email@hidden>
References: 
 >NSController, KVC & AppleScript not co-operating (From: Nicholas Shanks <email@hidden>)

  • Prev by Date: Project file parsing
  • Next by Date: PB and IB no longer launch
  • Previous by thread: Re: NSController, KVC & AppleScript not co-operating
  • Next by thread: Re: NSController, KVC & AppleScript not co-operating
  • Index(es):
    • Date
    • Thread