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

Class Method Detail

cancel(sender, evt)

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
captureTouch(touch)

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
See:
SC.Touch#captureTouch
contextMenu(evt)

Called when a contextmenu event is triggered. Used to disable contextmenu per view.

Parameters:
evt
{SC.Event} the contextmenu event
Returns:
void
deleteBackward(sender, evt)

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
deleteForward(sender, evt)

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
insertBacktab(sender, evt)
A field editor might respond by selecting the field before it.
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
insertNewline(sender, evt)
Insert a newline character or end editing of the receiver.
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
insertTab(sender, evt)
Insert a tab or move forward to the next field.
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
insertText(the)
Insert the text or act on the key.
Parameters:
the String
text to insert or respond to
Returns:
Boolean
YES if you handled the method; NO otherwise
mouseDown(evt)

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
mouseDragged(evt)

Called when the mouse is dragged, after responding YES to a previous mouseDown: call.

Parameters:
evt
{SC.Event} the mousemove event
Returns:
void
mouseEntered(evt)

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
mouseExited(evt)

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
mouseMoved(evt)

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
mouseUp(evt)
Called when the mouse is released.
Parameters:
evt
{SC.Event} the mouseup event
Returns:
Boolean
YES to handle the mouseUp, NO to allow click() and doubleClick() to be called
moveDown(sender, evt)
Move the insertion point/selection down one (i.e. down 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
moveDownAndModifySelection(sender, evt)
Move down, extending selection - shift || alt
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
moveLeft(sender, evt)
Move insertion point/selection backward one. (i.e. 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
moveLeftAndModifySelection(sender, evt)
Move left, extending the selection. - shift || alt
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
moveRight(sender, evt)

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
moveRightAndModifySelection(sender, evt)
Move right, extending the seleciton - shift || alt
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
moveToBeginningOfDocument(sender, evt)
Move insertion point/selection to beginning of document.
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
moveToEndOfDocument(sender, evt)
Move insertion point/selection to end of document.
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
moveUp(sender, evt)
Move the insertion point/selection up one (i.e. up 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
moveUpAndModifySelection(sender, evt)
Move up, extending the selection - shift || alt
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
pageDown(sender, evt)
Page down
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
pageUp(sender, evt)
Page up
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
performKeyEquivalent(charCode, evt)

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
selectAll(sender, evt)
Select all
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
selectStart(evt)

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
touchCancelled(touch)
Called when a touch previously claimed by returning `true` from `touchStart` is cancelled.
Parameters:
touch
{SC.Touch} the touch
Returns:
void
touchEnd(touch)
Called when a touch previously claimed by returning `true` from `touchStart` ends.
Parameters:
touch
{SC.Touch} the touch
Returns:
void
touchesDragged(evt, touches)

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
touchStart(touch)

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
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:21 GMT-0600 (CST)