04 April 2015

Windows - The behaviour of the standard textbox

For a custom textbox project, I observed the behaviour of the standard Windows textbox control, as to replicate this in the custom one. If you think of a behaviour not listed, please leave a comment below.

Terms

  • The caret represents the focussed character in the text. It is marked by displaying a blinking bar behind it.
  • The selection represents a range of characters from the caret until a second character. This character may occur before or after the caret.

Keyboard navigation

  • Shift left/right: the selection is expanded/contracted by one character.
  • Shift control left/right: the selection is expanded/contracted by one word.
  • Shift up/down: the selection is expanded/contracted to the character above/below the caret.
  • Home: the newline character of the line that contains the caret becomes the caret.
  • End: the last character of the line that contains the caret becomes the caret.
  • Page up/down: the text is scrolled so that the first/last visible becomes the last/first visible line. The character that occupies the screen space that the caret occupied becomes the caret.

Keyboard other

  • A key or key combination that represents a glyph; no selection: the character is inserted behind the caret, and becomes the caret.
  • A key or key combination that represents a glyph; with selection: the selection is removed. The first character before it becomes the caret. The character is inserted behind the caret, and becomes the caret.
  • Backspace; no selection: the caret is removed. It's predecessor becomes the caret.
  • Backspace; with selection: the selection is removed. The first character before it becomes the caret.
  • Delete; no selection: the character following the caret is removed.
  • Delete; with selection: the selection is removed. The first character before it becomes the caret.
  • Control+A: the selection is expanded, spanning from the first until the last character of the text.
  • Control+X: if there is a selection, the characters in it are copied to the clipboard. The selection is then removed.
  • Control+C: if there is a selection, the characters in it are copied to the clipboard.
  • Control+V: if the clipboard contains text, each character in that text is inserted behind the caret. The last one then becomes the caret.

Mouse

  • Click: if there is a selection, the selection is cleared. The clicked character becomes the caret. If before a line, the newline character becomes the caret. If after a line, the last character of the lines becomes the caret.
  • Double click: the clicked word becomes the selection. The last character of this selection becomes the caret.
  • Shift click: the range between the caret and the clicked character becomes the selection. The last character of this selection becomes the caret.
  • Click and drag: the caret follows the mouse. The selection expands and contracts from the clicked character to the caret, as long as the mouse button is not released. When the caret crosses the edge of the text area, it will scroll as well.

No comments:

Post a Comment