Chapter 13. EditFields

The EditField class is a built-in control for displaying text that the user can edit interactively, by typing, cutting, and pasting. This chapter explains how an EditField is used. An EditField instance can receive the focus, so this chapter also goes into some detail on what the focus is, and how to manipulate it in code.

Figure 13-1 shows a window containing a typical EditField.

An EditField

Figure 13-1. An EditField

Types of EditField

EditFields come in several types with different automatic behavior:

Nonstyled versus styled

A nonstyled EditField displays all its text in a uniform font, size, and style, like a StaticText. A styled EditField can have different fonts, sizes, and styles for different stretches of its text, like a SimpleText document.

Single-line versus multiline

A single-line EditField does not automatically wrap when text is too wide for the field (but you can make it consist of more than one line by means of return characters within its text). It is limited to a maximum of 32K characters. It implements automatic copying and pasting of text, but not styled text.

A multiline EditField wraps text automatically; it includes, optionally, a working vertical scrollbar. It can hold more than 32K characters of text. In a styled multiline field, copying and pasting of styled text works automatically.[104]

Password

A password EditField displays bullets instead of ...

Get REALBasic: TDG, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.