DEditBox

From Dabo Wiki
Jump to: navigation, search

This control allows editing of string data of unlimited size, spanning more than one line. The control will create scrollbars as necessary, and can edit string or unicode data.

Some of the more useful properties:

  • Alignment (str): Can be one of Left, Right, or Center. Determines the position of the text within the control area.
  • SelectedText (str): Returns just the text selected by the user, or an empty string.
  • SelectionStart, SelectionEnd, SelectionLength, InsertionPosition (int): Determines various aspects of the selected text in the control. Note that these properties are inter-dependent, so changing one can change one or more of the others.
  • ReadOnly (bool): allows the user to select and copy the text, but they cannot change it. This is different than Enabled=False, where they cannot interact with the control at all.
  • SelectOnEntry (bool): When True, the contents of the control are selected when the control receives focus.
  • PasswordEntry (bool): when True, the entered text is hidden, and bullets are shown instead. This must be set when the control is created.

There are also two convenience methods:

  • scrollToBeginning() - moves the insertion point to the beginning of the text in the control. Equivalent to setting self.InsertionPoint = 0.
  • scrollToEnd() - moves the insertion point to the end of the text in the control. Equivalent to setting self.InsertionPoint = len(self.Value).

Some of the more common events:

  • KeyChar: raised when a key is pressed. You can access information about that key and any modifiers with the following:
    • evt.keyChar: contains the character that was typed.
    • evt.keyCode: contains the internal number that represents the typed character. Will usually be the same as the ASCII value of that character.
    • evt.altDown, evt.commandDown, evt.controlDown, evt.metaDown, evt.shiftDown: these will be True if the corresponding modifier key was pressed when the key event occurred.
  • GotFocus: raised when the control receives focus.
  • LostFocus: raised when the control loses focus.

See the Dabo Class Documentation for an exhaustive documentation of this control's Properties, Events and Methods. (Note that this documentation is no longer live, but it's still available via the Internet Archive).