• 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: Simple Cocoa bindings question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple Cocoa bindings question


  • Subject: Re: Simple Cocoa bindings question
  • From: Matt Neuburg <email@hidden>
  • Date: Wed, 28 Mar 2007 08:38:05 -0700
  • Thread-topic: Simple Cocoa bindings question

On Tue, 27 Mar 2007 18:25:24 -0700, Roland Torres
<email@hidden> said:
>Using Cocoa bindings, I have a switch (NSButton) bound to an
>NSUserDefaultsController. I have the switch's action set to a certain
>method in my own controller object. This works fine: The switch's
>state is remembered from invocation to invocation, and when I click
>on the switch, my action method gets invoked.
>
>But: on startup when the switch's state setting is reconstituted from
>NSUserDefaultsController as NSOnState, the switch gets drawn with the
>checkmark, but my action method doesn't get invoked as a result of
>this. Is there a way to set it so my action method will get invoked
>if the defaults setting of the switch is the ON state?

A switch's action method is invoked *any* time it is clicked, not just when
the user switches it to the "on" state. So this really has nothing to do
with the action method per se. You simply want to do something, on startup,
if you discover that this default is YES. So do that (e.g. in
applicationDidFinishLaunching). m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Simple Cocoa bindings question
      • From: Roland Torres <email@hidden>
  • Prev by Date: Re: [MEET] CocoaHeads Meetings
  • Next by Date: Re: [MEET] CocoaHeads Meetings
  • Previous by thread: Re: Simple Cocoa bindings question
  • Next by thread: Re: Simple Cocoa bindings question
  • Index(es):
    • Date
    • Thread