views:

29

answers:

1

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

A: 

Solution: in order for the textfield to behave properly, I need to do everything through the bound instance variable.

The problem was that the "page" instance variable doesn't actually exist, there's a page method and a setPage method, but the actual page is kept elsewhere. When I make sure to call the setPage method from the next/prev code, it seems to work.

Brian Postow