• 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
Button performs action and then stores result to a binding?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Button performs action and then stores result to a binding?


  • Subject: Button performs action and then stores result to a binding?
  • From: Jonny Taylor <email@hidden>
  • Date: Wed, 29 Sep 2010 12:31:24 +0100

I have a modal dialog which, among other things, contains a number of file paths. There are "set..." buttons to set which files these are pointing to. I feel that with bindings I should be able to set things up automatically in InterfaceBuilder so that when that button is clicked a nav dialog is presented [ok, I'll probably need a subclass and/or custom action for that part...], and the appropriate bound parameter in my model is updated with the new path as chosen by the user.

Unfortunately I cannot work out how I would do this. Apple's BoundButton example shows how to use bindings to pass *input* parameters to a method that is invoked when a button is clicked. What I want to do is effectively to specify what happens to the *return parameter* of the method that is invoked. I'm pretty sure that this is not possible per se, but there must be some sort of relationship I can construct that will enable me to achieve what I want.

(I suspect I could achieve what I want by passing a pointer to the NSString* instance variable, thus enabling the action method to modify it, but that seems very wrong indeed. Similarly, if I could work out how, I might be able to pass the "setPathString:" selector on the model object as a parameter to the action method(!), but this again is so convoluted that it's probably telling me I'm not doing it right!)

I think what I'm trying to achieve is quite a tidy pattern - so what is the simple implementation that I am missing?
Thanks in advance
Jonny_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Button performs action and then stores result to a binding?
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Acquiring an NSConnection otherwise than by registered name?
  • Next by Date: Re: I want a window's file owner that's not a NSWindowController
  • Previous by thread: Re: Background-Task (Timer)
  • Next by thread: Re: Button performs action and then stores result to a binding?
  • Index(es):
    • Date
    • Thread