How does an NSTextField know that it's value has changed?

Posted by Brian Postow on Stack Overflow See other posts from Stack Overflow or by Brian Postow
Published on 2010-04-13T20:48:47Z Indexed on 2010/04/13 20:53 UTC
Read the original article Hit count: 309

Filed under:
|
|

I have a textfield that can either be edited by hand, or set through another control. (It's a page number, so you can jump to page 16 by typing in 16, or you can page up and down with the next/prev buttons) I have the value of the text field bound to an int page variable.

It seems to work correctly, when you type a page number in, it jumps, when you page up and down, the page number in the text box changes appropriately.

However, at some level, when I page up and down, the text box doesn't seem to know that it's value has changed, because if I type 1 it doesn't do anything. It doesn't call the bound set-method or anything. It looks like the textfield is thinking "I'm already 1, so I don't need to do anything." Even though it was 5 because I hit next 4 times. If I type an number other than 1, it goes there. If I THEN type 1, it goes to page 1, because now it thinks it's on that other page.

The problem seems to be that I'm changing the value of the textfield programatically, but some part isn't getting the message.

Does this seem like a reasonable explanation? And either way, any ideas on what's causing it?

thanks

© Stack Overflow or respective owner

Related posts about nstextfield

Related posts about cocoa