• 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: Don Briggs <email@hidden>
  • Date: Sat, 6 Mar 2004 16:38:38 -0800

Hello, Nick 

Presuming a Bindings-savvy AppleScriptable Cocoa application, in order for the UI to update when the app is driven by AppleScript, I find it necessary to add the lines

[self willChangeValueForKey: thisKey];
// main body of the set accessor goes here...
[self didChangeValueForKey: thisKey];

in the model's set accessors.

This seems like an oversight in the Cocoa APIs.
I'm hoping for clarification from Apple.

All best
Don

On Mar 6, 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.

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!)

- Nick.
_______________________________________________
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.
_______________________________________________
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.


References: 
 >NSController, KVC & AppleScript not co-operating (From: Nicholas Shanks <email@hidden>)

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