Class Delegate.TextField

TextField Delegate Interface.

the interface for controlling a TextField via a delegate.

Usage:

  •  local dUI = require 'dmc_ui'
    
     -- setup delegate object
    
     local delegate = {
    
       shouldBeginEditing=function(self, textField)
         return true
       end,
    
       onRowRender=function(self, textField)
         return true
       end,
    
       onRowUnrender=function(self, textField)
         return true
       end,
     }
  •  local widget = dUI.newTextField()
     widget.delegate = delegate
  •  local dUI = require 'dmc_ui'
     local widget = dUI.newTextField{
       delegate=delegate
     }

Methods

:shouldClearTextField (textField) (optional) ask if contents of Text Field should be cleared.
:shouldBeginEditing (textField) (optional) ask if editing should begin in the specified Text Field.
:shouldEndEditing (textField) (optional) ask if editing should end for the specified Text Field.
:shouldChangeCharacters (event) (optional) ask if TextField should be updated according to changed character(s).


Methods

:shouldClearTextField (textField)
(optional) ask if contents of Text Field should be cleared. if the method is omitted, the text is cleared as if this method had returned true.

Parameters:

  • textField the Text Field containing the text.

Returns:

    bool return true to clear Text Field contents
:shouldBeginEditing (textField)
(optional) ask if editing should begin in the specified Text Field. if the method is omitted, the edit is Started as if this method had returned true.

Parameters:

  • textField the Text Field for which editing is about to Begin.

Returns:

    bool return true to allow editing
:shouldEndEditing (textField)
(optional) ask if editing should end for the specified Text Field. if the method is omitted, the edit is Ended as if this method had returned true.

Parameters:

  • textField the Text Field for which editing is about to End.

Returns:

    bool return true to end editing
:shouldChangeCharacters (event)
(optional) ask if TextField should be updated according to changed character(s). if the method is omitted, it's as if this method had returned true.

Parameters:

  • event the event table
    • target object the TableView
    • startPosition string the location at which the change took place
    • newCharacters string the changed characters
    • numDeleted number the amount of characters deleted
    • text string the complete text string with changes

Returns:

    bool return true to keep the changes
generated by LDoc 1.4.3 Last updated 2015-05-14 11:55:05