Protocol: SC.ResponderProtocol
The SC.ResponderProtocol
protocol defines the properties and methods that you may implement
in your SC.Responder
(i.e. SC.View
) subclasses in order to handle specific responder chain
events.
Note: Do not mix SC.ResponderProtocol
into your classes. As a protocol, it exists only for
reference sake. You only need define any of the properties or methods listed below in order to use
this protocol.*
Defined in: responder_protocol.js
- Since:
- SproutCore 1.0
Class Methods
- cancel(sender, evt)
- captureTouch(touch)
- contextMenu(evt)
- deleteBackward(sender, evt)
- deleteForward(sender, evt)
- insertBacktab(sender, evt)
- insertNewline(sender, evt)
- insertTab(sender, evt)
- insertText(the)
- mouseDown(evt)
- mouseDragged(evt)
- mouseEntered(evt)
- mouseExited(evt)
- mouseMoved(evt)
- mouseUp(evt)
- moveDown(sender, evt)
- moveDownAndModifySelection(sender, evt)
- moveLeft(sender, evt)
- moveLeftAndModifySelection(sender, evt)
- moveRight(sender, evt)
- moveRightAndModifySelection(sender, evt)
- moveToBeginningOfDocument(sender, evt)
- moveToEndOfDocument(sender, evt)
- moveUp(sender, evt)
- moveUpAndModifySelection(sender, evt)
- pageDown(sender, evt)
- pageUp(sender, evt)
- performKeyEquivalent(charCode, evt)
- selectAll(sender, evt)
- selectStart(evt)
- touchCancelled(touch)
- touchEnd(touch)
- touchesDragged(evt, touches)
- touchStart(touch)
Class Method Detail
This method is called if no other view in the current view hierarchy is bound to the escape or command-. key equivalent. You can use this to cancel whatever operation is running.
- Parameters:
- sender
- {Object} the object that triggered; may be null
- evt
- {SC.Event} the event that triggered the method
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
Called when a touch begins. Capturing a touch is a special case behavior that allows for the
nesting of touch capable views. In some situations, an outer view may want to capture a touch
before* the inner view acts on it. For example, a container view may want to act on swipes or
pinches, while the inner view may only respond to taps. If the normal event path was followed,
the inner view would get the touchStart
event and by accepting it, would inadvertently prevent
the outer view from being able to act on it.
For this reason, when a touch begins, each view from the top-down has a chance to capture a
touch first, before it is passed to the bottom-most target view. For example, SC.ScrollView
captures touches so that it can determine if the touch is the beginning of a swipe or pinch. If
the touch does become one of these gestures, SC.ScrollView
can act on it. However, if the touch
doesn't become one of these gestures, SC.ScrollView
understands that it needs to pass the touch
to its children.
Therefore, implementors of captureTouch
are expected to release the touch if they won't use it
by calling the touch's captureTouch
method and passing themself as the new starting point
(capturing will continue from the implementor onward as it would have if the implementor hadn't
temporarily captured it).
Note, captureTouch
is only meaningful for container type views where their children may
handle touches as well. For most controls that want to handle touch, there is no reason to
capture a touch, because they don't have any children. For these views, simply use the
touchStart
, touchesDragged
, touchCancelled
and touchEnd
methods.
- Parameters:
- touch
- {SC.Touch} the touch
- Returns:
- Boolean
- YES to claim the touch and receive touchStart, NO otherwise
Called when a contextmenu event is triggered. Used to disable contextmenu per view.
- Parameters:
- evt
- {SC.Event} the contextmenu event
- Returns:
- void
Delete the current selection or delete one element backward from the current selection.
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
Delete the current selection or delete one element forward from the current selection.
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
Called when the mouse is pressed. You must return YES
to receive
mouseDragged
and mouseUp
in the future.
- Parameters:
- evt
- {SC.Event} the mousedown event
- Returns:
- Boolean
- YES to receive additional mouse events, NO otherwise
Called when the mouse is dragged, after responding YES
to a previous mouseDown
:
call.
- Parameters:
- evt
- {SC.Event} the mousemove event
- Returns:
- void
Called when the mouse enters the view and the root responder is not in a drag session.
- Parameters:
- evt
- {SC.Event} the mousemove event
- Returns:
- void
Called when the mouse exits the view and the root responder is not in a drag session.
- Parameters:
- evt
- {SC.Event} the mousemove event
- Returns:
- void
Called when the mouse moves within the view and the root responder is not in a drag session.
- Parameters:
- evt
- {SC.Event} the mousemove event
- Returns:
- void
- Parameters:
- evt
- {SC.Event} the mouseup event
- Returns:
- Boolean
- YES to handle the mouseUp, NO to allow click() and doubleClick() to be called
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
Move the insertion point/selection forward one (i.e. right arrow key) in left-to-right text, this could be the left arrow key.
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
When the user presses a key-combination event, this will be called so you can run the command.
- Parameters:
- charCode
- {String} the character code
- evt
- {SC.Event} the keydown event
- Returns:
- Boolean
- YES if you handled the method; NO otherwise
- Parameters:
- sender
- {Object} the object that triggered the method; may be null
- evt
- {SC.Event} the event that triggered the method; may be null
- Returns:
- Boolean
- YES if you handle the event; NO otherwise
Called when a selectstart event in IE is triggered. ONLY IE We use it to disable IE accelerators and text selection
- Parameters:
- evt
- {SC.Event} the selectstart event
- Returns:
- void
- Parameters:
- touch
- {SC.Touch} the touch
- Returns:
- void
- Parameters:
- touch
- {SC.Touch} the touch
- Returns:
- void
Called when an active touch moves. The touches array contains all of the touches that this view
has claimed by returning true
from touchStart
.
- Parameters:
- evt
- {SC.Event} the event
- touches
- {Array} the touches
- Returns:
- void
Called when a touch begins. You must return YES
to receive touchesDragged
and touchEnd
in
the future.
- Parameters:
- touch
- {SC.Touch} the touch
- Returns:
- Boolean
- YES to receive additional touch events, NO otherwise