Next Key View doesn't "go to" pushbutton

  • I've got a number of text boxes to be filled in by the user.  Tab order
    works fine using next key view in IB.  After filing the last box, I'd like
    the user to be able to tab to a "commit" button, but next key view doesn't
    go there, even though the IB heads up boxes and inspector panes show that
    it does.

    Ideally, tabbing to the Commit button would bring it into focus, light its
    focus ring, and the allow the user to press "enter" (or "return" :-). to
    commit the data.  Then the next key view would recycle to the first in the
    sequence of text fields.

    Seems that this should be possible to set up in IB, but  dogon if I'm
    seein' a way to do it (been watching too much campaign TV lately).

    Related question:  How can I (again in IB) set it so the return key follows
    the next key view sequence as well as tab key does?

    Neither Hillgass nor Anderson seem to cover these (I admit I read
    impatiently and rely on the index a lot), and the Apple documentation (and
    various archives) are so extensive I haven't been able to hit exactly the
    key words to get to the answers.

    Best,

    John Velman
  • John,

    In System Preferences, Keyboard & Mouse, Keyboard Shortcuts, is Full
    keyboard access set to All controls?

    -Jeff

    On Oct 7, 2008, at 1:47 PM, John Velman wrote:

    > I've got a number of text boxes to be filled in by the user.  Tab
    > order
    > works fine using next key view in IB.  After filing the last box,
    > I'd like
    > the user to be able to tab to a "commit" button, but next key view
    > doesn't
    > go there, even though the IB heads up boxes and inspector panes
    > show that
    > it does.
    >
    > Ideally, tabbing to the Commit button would bring it into focus,
    > light its
    > focus ring, and the allow the user to press "enter" (or
    > "return" :-). to
    > commit the data.  Then the next key view would recycle to the first
    > in the
    > sequence of text fields.
    >
    > Seems that this should be possible to set up in IB, but  dogon if I'm
    > seein' a way to do it (been watching too much campaign TV lately).
    >
    > Related question:  How can I (again in IB) set it so the return key
    > follows
    > the next key view sequence as well as tab key does?
    >
    > Neither Hillgass nor Anderson seem to cover these (I admit I read
    > impatiently and rely on the index a lot), and the Apple
    > documentation (and
    > various archives) are so extensive I haven't been able to hit
    > exactly the
    > key words to get to the answers.
    >
    > Best,
    >
    > John Velman
  • You could override the controlTextDidEndEditing method:

    - (void)controlTextDidEndEditing:(NSNotification *)aNotification{
        ...
        if([[[aNotification userInfo] valueForKey:@"NSTextMovement"] intValue]
            == NSReturnTextMovement) {
            //  invoke whatever button pressed code.
            }
        }

    This can be advantageous if you allow empty fields.  The user can use the
    enter key while the cursor is in any field instead of tabbing all the way to
    the button.

    You can also check for "NSTabTextMovement" or "NSBacktabTextMovement" if you
    want to do any processing between fields.

    On 10/07/08 2:02 PM, "<cocoa-dev-request...>"
    <cocoa-dev-request...> wrote:

    > Next Key View doesn't "go to" pushbutton
  • On Tue, Oct 07, 2008 at 02:09:05PM -0500, Jeff Johnson wrote:
    > John,
    >
    > In System Preferences, Keyboard & Mouse, Keyboard Shortcuts, is Full
    > keyboard access set to All controls?
    >
    > -Jeff

    Blush.  Fixing the  Next key view sequence was simple.  I'm not only new to
    Cocoa, new to Mac as well.  (And very happy with both, as well as the
    helpful people on this list.)

    Thanks,

    John V.

    >
    >
    > On Oct 7, 2008, at 1:47 PM, John Velman wrote:
    >
    >> I've got a number of text boxes to be filled in by the user.  Tab order
    >> works fine using next key view in IB.  After filing the last box, I'd like
    >> the user to be able to tab to a "commit" button, but next key view doesn't
    >> go there, even though the IB heads up boxes and inspector panes show that
    >> it does.
    >>
    >> Ideally, tabbing to the Commit button would bring it into focus, light its
    >> focus ring, and the allow the user to press "enter" (or "return" :-). to
    >> commit the data.  Then the next key view would recycle to the first in the
    >> sequence of text fields.
    >>
    >> Seems that this should be possible to set up in IB, but  dogon if I'm
    >> seein' a way to do it (been watching too much campaign TV lately).
    >>
    >> Related question:  How can I (again in IB) set it so the return key
    >> follows
    >> the next key view sequence as well as tab key does?
    >>
    >> Neither Hillgass nor Anderson seem to cover these (I admit I read
    >> impatiently and rely on the index a lot), and the Apple documentation (and
    >> various archives) are so extensive I haven't been able to hit exactly the
    >> key words to get to the answers.
    >>
    >> Best,
    >>
    >> John Velman
    >
  • On Tue, Oct 7, 2008 at 4:17 PM, John Velman <velman...> wrote:
    > Blush.  Fixing the  Next key view sequence was simple.  I'm not only new to
    > Cocoa, new to Mac as well.  (And very happy with both, as well as the
    > helpful people on this list.)

    Yes, the fact that buttons etc. can't become key takes some getting
    used to for Windows folk.  You might not have noticed, but the machine
    actually refuses to let you log in without a mouse connected.  (Well,
    on machines with Bluetooth it will try to find a Bluetooth mouse.)
    This is why.

    --Kyle Sluder