Immediate sending of changes to text fields

  • I am having both a normal NSTextField and a NSTokenField, for which I
    need to process changes immediately after the user made a change.
    Both fields are connected to their controller via the value binding.

    I tried to call -[NSController commitEditing] when receiving a
    NSControlTextDidChangeNotification. This does update the value, but
    also resigns the first responder state of the field in question,
    which is not wanted.

    By searching this list I found a hint that -[NSControll
    validateEditing] might help, but it does not, at least for me.

    Of course I can use -[NSControl objectValue] inside
    NSControlTextDidChangeNotification, but this is not really how
    bindings should work in my opinion.

    This must be not so seldom a request, mustn't it?

    Thanks,
    Kai
  • Le 6 déc. 07 à 11:09, Kai Brüning a écrit :

    > I am having both a normal NSTextField and a NSTokenField, for which
    > I need to process changes immediately after the user made a change.
    > Both fields are connected to their controller via the value binding.
    >
    > I tried to call -[NSController commitEditing] when receiving a
    > NSControlTextDidChangeNotification. This does update the value, but
    > also resigns the first responder state of the field in question,
    > which is not wanted.
    >
    > By searching this list I found a hint that -[NSControll
    > validateEditing] might help, but it does not, at least for me.
    >
    > Of course I can use -[NSControl objectValue] inside
    > NSControlTextDidChangeNotification, but this is not really how
    > bindings should work in my opinion.
    >
    > This must be not so seldom a request, mustn't it?
    >
    > Thanks,
    > Kai

    In Interace Builder, in your binding settings, check the box:
    "Continuously Updates Value"

    Jean-Daniel Dupas
  • Am 06.12.2007 um 11:09 schrieb Kai Brüning:

    > I am having both a normal NSTextField and a NSTokenField, for which
    > I need to process changes immediately after the user made a change.
    > Both fields are connected to their controller via the value binding.

    Try checking "Continuously Updates Value" in the bindings pane in IB.

    Cheers,

    Knut
  • > Le 6 déc. 07 à 11:09, Kai Brüning a écrit :
    >
    >> I am having both a normal NSTextField and a NSTokenField, for which I need to process changes immediately after the user made a change. Both fields are connected to their controller via the value binding.
    >>
    >> I tried to call -[NSController commitEditing] when receiving a NSControlTextDidChangeNotification. This does update the value, but also resigns the first responder state of the field in question, which is not wanted.
    >>
    >> By searching this list I found a hint that -[NSControll validateEditing] might help, but it does not, at least for me.
    >>
    >> Of course I can use -[NSControl objectValue] inside NSControlTextDidChangeNotification, but this is not really how bindings should work in my opinion.
    >>
    >> This must be not so seldom a request, mustn't it?
    >>
    >> Thanks,
    >> Kai
    >
    > In Interace Builder, in your binding settings, check the box: "Continuously Updates Value"
    >
    > Jean-Daniel Dupas

    Thanks a lot, so easy. I was just too focused on the NSTextField Attributes settings...

    Kai
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today