Contents

edit(withFrame:in:editor:delegate:event:)

Begins editing of the receiver’s text using the specified field editor.

Declaration

func edit(withFrame rect: NSRect, in controlView: NSView, editor textObj: NSText, delegate: Any?, event: NSEvent?)

Parameters

  • rect:

    The bounding rectangle of the cell.

  • controlView:

    The control that manages the cell.

  • textObj:

    The field editor to use for editing the cell.

  • delegate:

    The object to use as a delegate for the field editor (textObj parameter). This delegate object receives various NSText delegation and notification methods during the course of editing the cell’s contents.

  • event:

    The NSLeftMouseDown event that initiated the editing behavior.

Discussion

If the receiver isn’t a text-type NSCell object, no editing is performed. Otherwise, the field editor (textObj) is sized to aRect and its superview is set to controlView, so it exactly covers the receiver. The field editor is then activated and editing begins. It’s the responsibility of the delegate to end editing when responding to textShouldEndEditing(_:). Upon ending the editing session, the delegate should remove any data from the field editor.

See Also

Editing and Selecting Text