Jump To:
Leopard Reference Library: Cocoa
Events are high-level messages sent to applications by the operating system. For example, when the user clicks the mouse, types a character, chooses a menu command, moves a window, or activates an application, Mac OS X dispatches an event to the appropriate application. Other forms of input, such as notifications, can be generated programmatically. Cocoa provides mechanisms and programmatic interfaces to assist applications in receiving and responding appropriately to events and other types of input.

Document Descriptions
On Off
Display

Sorted by
Title
Sort by
Resource Type
Sort by
Date
Action Messages (HTML) (PDF)
Explains how Cocoa controls respond to user actions and enable users to communicate to an application.
Guides 2002-11-12
Background-only apps with NSStatusItems become active in 10.1 on NSStatusItem clicks (HTML)
QA1081: Preventing background-only apps from activating when their NSStatusItem(s) are clicked in Mac OS X 10.1.
Technical Q&As 2001-10-30
BindingsJoystick (HTML) (DMG) (ZIP)
Illustrates a bindings-enabled subclass of NSView.
Sample Code 2005-06-01
CarbonCocoaTempConverter (HTML) (DMG) (ZIP)
Demonstrates how to integrate Carbon and Cocoa user interfaces in the same Cocoa application.
Sample Code 2008-03-10
CarbonInCocoa (HTML) (DMG) (ZIP)
How to use Carbon GUI code in a Cocoa application.
Sample Code 2003-03-26
Cocoa Event-Handling Guide (HTML) (PDF)
Introduces event mechanisms and the types of events in Cocoa and describes how to handle events of each type.
Guides 2009-02-04
CocoaDragAndDrop (HTML) (DMG) (ZIP)
Implement Drag-and-Drop functionality in Cocoa (uses images; can be extended to support other data types).
Sample Code 2003-01-14
Color Sampler (HTML) (DMG) (ZIP)
Demonstrates one way to sample the color at a given point in an NSView.
Sample Code 2003-01-14
ColorSyncDevices-Cocoa (HTML) (DMG) (ZIP)
Demonstrates how to use the new ColorSync Device Manager routines in the Cocoa environment.
Sample Code 2003-01-14
CrossEvents (HTML) (DMG) (ZIP)
Demonstrates how to send CarbonEvents and NSNotifications between Carbon and Cocoa.
Sample Code 2007-05-31
Cursor Management (HTML) (PDF)
Explains how to set the cursor and handle cursor-update events in Cocoa applications.
Guides 2008-03-11
Detecting the Caps Lock Key (HTML)
QA1519: Explains how to detect when the caps lock key is turned on and off.
Technical Q&As 2007-05-11
Dicey (HTML) (DMG) (ZIP)
Dicey is a dice game project that demonstrates various techniques for making a Cocoa application accessible.
Sample Code 2006-08-01
Drag and Drop Programming Topics for Cocoa (HTML) (PDF)
Explains how to implement drag and drop in Cocoa.
Guides 2006-06-28
Driving OpenGL Rendering Loops (HTML)
QA1385: Using Core Video display links (CVDisplayLink) or Cocoa timers (NSTimer) to drive an OpenGL rendering loop
Technical Q&As 2009-05-01
Frequently Asked Text Services Manager (TSM) Questions (HTML)
TN2128: Regroups a collection of Text Services Manager (TSM) questions frequently asked by Input Method Developers
Technical Notes 2005-06-24
FunkyOverlayWindow (HTML) (DMG) (ZIP)
Demonstrates several window layering, transparency and widget interaction techniques in Cocoa.
Sample Code 2003-05-08
JDragNDrop (HTML) (DMG) (ZIP)
Deprecated - Demonstrates building a simple view to implement Drag-and-Drop functionality in Cocoa-Java.
Sample Code 2003-01-14
Notification Programming Topics for Cocoa (HTML) (PDF)
Explains how to send and receive information about events in Cocoa programs.
Guides 2007-05-03
NSAlert Class Reference (HTML) (PDF)
Describes a window that displays a message and obtains the user's response to it.
Reference 2007-04-25
NSBrowser Class Reference (HTML) (PDF)
Describes a control for manipulating one- or two-dimensional data sets.
Reference 2007-04-05
NSButton Class Reference (HTML) (PDF)
Describes a control that responds to clicks.
Reference 2007-04-01
NSButtonCell Class Reference (HTML) (PDF)
Describes a cell that responds to mouse clicks.
Reference 2009-04-08
NSDistributedNotificationCenter Class Reference (HTML) (PDF)
Describes an object that synchronously broadcasts notifications to other tasks.
Reference 2007-04-01
NSDraggingDestination Protocol Reference (HTML) (PDF)
Describes the interface for objects receiving dragged images.
Reference 2007-03-01
NSDraggingInfo Protocol Reference (HTML) (PDF)
Describes the interface for supplying useful information to a dragging destination.
Reference 2007-03-01
NSDraggingSource Protocol Reference (HTML) (PDF)
Describes the interface for receiving messages when providing a dragged image.
Reference 2007-03-01
NSEvent Class Reference (HTML) (PDF)
Describes an input action such as a mouse click.
Reference 2009-02-04
NSHelpManager Class Reference (HTML) (PDF)
Describes an application-level help system.
Reference 2009-02-04
NSInputManager Class Reference (HTML) (PDF)
Describes the class used by text views to communicate with the text input management system.
Reference 2007-04-01
NSInputServer Class Reference (HTML) (PDF)
Describes the class that interprets text view events and communicates them to the text input management system.
Reference 2007-04-01
NSInputServerMouseTracker Protocol Reference (HTML) (PDF)
Describes the protocol implemented by text input servers to handle mouse events.
Reference 2007-04-02
NSInputServiceProvider Protocol Reference (HTML) (PDF)
Describes the protocol implemented by text input servers to handle application and text field events.
Reference 2007-04-02
NSNotification Class Reference (HTML) (PDF)
Describes information to be broadcast to other objects through a notification center.
Reference 2007-04-02
NSNotificationCenter Class Reference (HTML) (PDF)
Describes an object that synchronously broadcasts notifications.
Reference 2008-07-11
NSNotificationQueue Class Reference (HTML) (PDF)
Describes an object that asynchronously broadcasts notifications.
Reference 2007-04-02
NSOpenPanel Class Reference (HTML) (PDF)
Describes the panel that a user employs to locate and open a file.
Reference 2009-02-04
NSPanel Class Reference (HTML) (PDF)
Describes a window for performing auxiliary functions in an application.
Reference 2009-01-06
NSResponder Class Reference (HTML) (PDF)
Describes the interface for handling events.
Reference 2007-03-05
NSRunLoop Class Reference (HTML) (PDF)
Describes the object that manages events on a thread.
Reference 2008-02-08
NSSavePanel Class Reference (HTML) (PDF)
Describes the panel that a user employs to set a file-system location and save a file.
Reference 2009-02-04
NSSpeechRecognizer Class Reference (HTML) (PDF)
Describes the Cocoa command-and-control voice recognition system.
Reference 2007-04-03
NSTextInput Protocol Reference (HTML) (PDF)
Descibes the formal protocol that text views implement to receive input from the user's keyboard and mouse.
Reference 2006-05-23
NSTextInputClient Protocol Reference (HTML) (PDF)
Describes the interface for receiving keyboard input as properly formed text.
Reference 2008-10-15
NSTimer Class Reference (HTML) (PDF)
Describes a timer.
Reference 2008-11-19
NSTrackingArea Class Reference (HTML) (PDF)
Describes a view region used for mouse tracking and cursor updating.
Reference 2007-03-09
NSView Class Reference (HTML) (PDF)
Describes the interface for drawing, event handling, and printing in views.
Reference 2009-02-04
NSWindow Class Reference (HTML) (PDF)
Describes a window.
Reference 2009-03-04
NumberInput_IMKit_Sample (HTML) (DMG) (ZIP)
Illustrates an input method that uses the Mac OS X 10.5 InputMethodKit framework.
Sample Code 2008-03-17
Pasteboard Programming Topics for Cocoa (HTML) (PDF)
Explains how to transfer data using pasteboard operations in Cocoa.
Guides 2007-07-13
PhotoSearch (HTML) (DMG) (ZIP)
Demonstrates advanced controls and cells. Custom drawing, hit testing, tracking, editing, expansion tooltips, tracking areas.
Sample Code 2008-03-05
Power Management; Policy Maker vs. Power Controller (HTML) (日本語 HTML)
QA1121: Describes the differences between a Power Management Policy Maker and a Power Management Power Controller.
Technical Q&As 2002-02-13
Programmatically causing restart, shutdown and/or logout (HTML) (日本語 HTML)
QA1134: Describes how to programmatically cause restart, shutdown, sleep or logout.
Technical Q&As 2008-09-24
RGB Image (HTML) (DMG) (ZIP)
Demonstrates compositing to separate an NSimage into its RGB components, and how to recombine those components.
Sample Code 2003-01-14
SearchField (HTML) (DMG) (ZIP)
Demonstrates how to use and customize the features of the "NSSearchField" control.
Sample Code 2007-04-25
SetMouseAcclSample (HTML) (DMG) (ZIP)
Find HID System Manager and get/set cursor acceleration
Sample Code 2006-11-28
SonOfSillyBalls (HTML) (DMG) (ZIP)
Draws a bunch of randomly colored, randomly placed, silly balls in a window on the screen.
Sample Code 2003-01-14
Squiggles (HTML) (DMG) (ZIP)
Demonstrates many Cocoa fundamentals in a Document-based Application featuring custom drawing and event-handling.
Sample Code 2008-08-29
Text Input Management (HTML) (PDF)
Explains how to use input servers, input managers, and text views in Cocoa.
Guides 2007-02-08
Timer Programming Topics for Cocoa (HTML) (PDF)
Explains how to use timers for scheduling automatic, repeating message invocations in Cocoa.
Guides 2008-11-19
ToolbarSample (HTML) (DMG) (ZIP)
Demonstrates using the Cocoa NSToolbar/NSToolbarItem API to add customizable toolbars to windows. Includes advanced custom views.
Sample Code 2003-01-14
TrackBall (HTML) (DMG) (ZIP)
Demonstrates how to build a custom control based on the NSControl class.
Sample Code 2007-06-07
Using Secure Event Input Fairly (HTML)
TN2150: Describes the proper use of EnableSecureEventInput.
Technical Notes 2007-06-08
Why aren't my tracking rects working? (HTML)
QA1355: Describes a common mistake in setting up cursor-tracking rectangles.
Technical Q&As 2004-12-02