NSView Exploration
November 19, 2007 by Philippe Mougin
Visual elements in a Cocoa application are NSView objects (and have been since the early days of NEXTSTEP in the 80s). F-Script 2.0 makes it easier to select and explore them with the object browser.
- The Select View tool, which let you select an NSView by just clicking on it on screen, now provides visual feedback. The color of the view that is under the cursor is temporarily modified to give immediate feedback as the cursor moves and to show the surface covered by the view on screen. A HUD near the cursor displays information about the view underneath.
- You can now exit the view selection mode without actually selecting a view, by pressing the ESCAPE key.
- When looking at an NSView in the object browser, the view hierarchy is now displayed up front. This makes it easy to quickly explore the hierarchy, navigating down to subviews or up to the superview.


The idea of providing visual feedback as the cursor moves over views and the implementation strategy were suggested by Ken Ferry, while we were working on our F-Script Google Tech Talk just after WWDC 2007. BTW, Ken has some interesting software here, and, if you are reading this on a Mac, you are already using stuff developed by Ken, as he is one of the AppKit engineers.
Very cool.
Now, what would make it even cooler is being able to select a view with the mouse, and set a breakpoint on any of the methods that the view implements, with the appropriate debugger parameters to only break on that method for that instance, etc.
-jcr