Do something when an NSTextView gains focus

  • Good day and respect to all you programmers!
    I need to accomplish a trivial task — when the user presses Tab to go
    to nextKeyView, that view (actually, an NSTextView) should select all
    text (That's quite a common behaviour, I suppose). But as I'm only a
    beginner, I've stuck with documentation and cannot find any simple way
    of doing this (that is, how to do something when a view becomes a first
    responder), although I'm sure it is there.
    Could you please be helpful to hint me about it?

    Yours truly,
    Three-eyed Fish
  • on 10/17/06 1:56 AM, <threeeyedfish...> purportedly said:

    > I need to accomplish a trivial task ‹ when the user presses Tab to go
    > to nextKeyView, that view (actually, an NSTextView) should select all
    > text (That's quite a common behaviour, I suppose). But as I'm only a
    > beginner, I've stuck with documentation and cannot find any simple way
    > of doing this (that is, how to do something when a view becomes a first
    > responder), although I'm sure it is there.
    > Could you please be helpful to hint me about it?

    Look up NSTextField in the documentation and check out the delegate methods.
    You may also want to look into the Interface Builder docs for setting
    delegate outlets.

    Best,

    Keary Suska
    Esoteritech, Inc.
    "Demystifying technology for your home or business"
  • On 17 Oct 2006, at 08:56, Damian Terentyev wrote:

    > Good day and respect to all you programmers!
    > I need to accomplish a trivial task — when the user presses Tab to
    > go to nextKeyView, that view (actually, an NSTextView) should
    > select all text (That's quite a common behaviour, I suppose). But
    > as I'm only a beginner, I've stuck with documentation and cannot
    > find any simple way of doing this (that is, how to do something
    > when a view becomes a first responder), although I'm sure it is there.
    > Could you please be helpful to hint me about it?
    >
    > Yours truly,
    > Three-eyed Fish
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/mike.abdullah%
    > 40gmail.com
    >
    > This email sent to <mike.abdullah...>

    Yes, I think you probably want to use an NSTextField instead of an
    NSTextView.  The text view is meant for large areas of text, and it
    sounds like you want a single line of text instead.

    Mike. _______________________________________________
    Do not post admin requests to the list. They will be ignored.
    Cocoa-dev mailing list      (<Cocoa-dev...>)
    Help/Unsubscribe/Update your Subscription:
    http://lists.apple.com/mailman/options/cocoa-dev/<cocoa...>

    This email sent to <cocoa...>
previous month october 2006 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