Bindings will not do this for you. Instead, hook your controller up to the text 
field's action, which will be sent every time the user hits return.

On 14 Apr 2011, at 13:24, Jonathan Taylor wrote:

> I haven't managed to work out how to get the behaviour I want from my 
> interface, and I'm hoping somebody can help me out. It may be that I am 
> misusing my interface elements, but any suggestions would be welcome.
> 
> What I believe I want is for the appropriate setXXX method to be called when 
> I press return for a text field, even if its contents have NOT changed. i.e. 
> I type in "10" and press return and setXXX is called, but if I then press 
> return again, setXXX is called a second time (or at least I have some way of 
> knowing that return was pressed a second time).
> 
> The rationale behind why I want to do this is as follows:
> 
> I am controlling a stepper motor, and the user can direct command the 
> position it should move to using the following interface:
> www.dur.ac.uk/j.m.taylor/commanded_and_current_value.png
> In that screenshot I have just commanded a move to z=2000um and it is in 
> motion to that target, currently at 755.43um.
> 
> However, as well as this direct command of the position, there are various 
> actions the user can take that will trigger the motor to move, potentially on 
> a relatively complex trajectory. My design choice, which I think makes sense, 
> is for the "current" value readout to update during that trajectory, but for 
> the commanded value to remain unchanged. [At the end of the trajectory the 
> "commanded" value changes to reflect the final resting point of the motor]. 
> Otherwise the "commanded" value, a user-editable field, may be continuously 
> updating without any user intervention, which I don't feel is right.
> 
> That's all fine, but I would additionally like the user to be able to 
> interrupt the trajectory in progress by issuing a new direct command. From a 
> user's point of view, if you click back onto the "command" text field and 
> press return again I think you would expect that this would command the motor 
> to move again to the value in that text field. However, because that is the 
> same value as the one "set" last time for the property, setXXX is not called 
> a second time, and my code is not aware that the user has done anything.
> 
> I think the desired behaviour I am describing here is effectively a sort of 
> "write only" behaviour for the bound property, but writeonly does not appear 
> to be a valid specified (and I can see why...). Hopefully what I have 
> described here makes sense. Can anybody suggest how I can achieve the sort of 
> thing I am after here? I can see various notifications etc that I may be able 
> to hook into to do the sort of thing I want, but I am not sure where the best 
> place to hook in would be. I wonder if it may be within the binding-related 
> messages themselves (something I am not familiar with the internal workings 
> of...)
> 
> Thanks for your help
> Jonny_______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to