Virgil Dupras committed 4d61bb0

Added TextField.usesSingleLineMode and set cell.scrollable to True by default (like IB does).

  • Participants
  • Parent commits 04abcc7

Comments (0)

Files changed (2)

File docs/api/textfield.rst

         :class:`Color`. Color of the text within the field. Equivalent to ``[self textColor]``.
+    .. attribute:: usesSingleLineMode
+        *Boolean*. Whether the text field is allowed to have more than one line. Same as
+        "Uses Single Line Mode" in XCode's IB.

File xibless/

-from .base import const
 from .property import Property
 from .control import Control, ControlHeights
 from .font import Font, FontFamily, FontSize
         Property('text', 'stringValue'), 'textColor', 
         Property('placeholder', 'cell.placeholderString'),
+        Property('usesSingleLineMode', 'cell.usesSingleLineMode')
     def __init__(self, parent, text=None):
         tmpl = Control.generateInit(self)['editable'] = True['selectable'] = True
+        # By default in IB, a textfield is scrollable. This allows a smooth overflow management.
+        # If it's false, as soon as you type a character that overflows the field, the whole line
+        # disappears and is replaced by the new character. With scrollable to True, the text scrolls
+        # and makes editing smoother.
+['cell.scrollable'] = True
         return tmpl