• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Following focus and scrolling controls into view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Following focus and scrolling controls into view


  • Subject: Re: Following focus and scrolling controls into view
  • From: Mason Mark <email@hidden>
  • Date: Mon, 17 Sep 2001 11:21:12 -0700

--On Saturday, September 15, 2001 9:44 PM -0700 I <email@hidden> wrote:

An app I am working on has a window containing a scrollable view
containing many controls (buttons, text fields, text
views...functionally similar to a typical web form that extends down
beyond the window's edge).

As the user tabs between text fields and controls, they may tab to an
offscreen control. In this case, I would like to scroll the enclosing
view down programatically, so that the focused control is visible in the
document window.

I think there must be a mechanism by which my app can "notice" when a new
control or view gets the focus, since this is standard behavior for so
many apps. Can anybody point me in the right direction?


Thanks to those who offerred suggestions on and off the list. There were a few suggestions which would all work, I think, including subclassing the controls which I want to autoscroll into view and overriding -becomeFirstResponder:, and subclassing NSResponder and using +poseAsClass: to implement a notification whenever any control becomes first responder.

What I ended up doing was simply subclassing NSWindow and overriding -makeFirstResponder: to call super's implementation, and if the return value is YES, post a notification with the control that is becoming first responder as the notification object.

I think this is probably the simplest way to go. It's worked fine for me.

Thanks again,

--
Mason Mark
Five Speed Software


  • Prev by Date: Re: Dot View + creating custom NSTable
  • Next by Date: Re: distributed processing ad multiThreading
  • Previous by thread: Re: Following focus and scrolling controls into view
  • Next by thread: Getting small time increments
  • Index(es):
    • Date
    • Thread