[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Programmer's Guide



Chapter 10. Text

Motif has widgets for displaying two kinds of text: static text, as in labels and messages, and editable text. Static text usually appears in Label widgets or Label subclasses, including buttons, and in Lists. The application or user can specify initial text for Labels or Lists by using resource or UIL files, but the user cannot edit the text. The application can replace the text during the program by setting the appropriate resources. In Labels and Label subclasses and in Lists, Motif represents text as compound strings. These are opaque data types that contain the text itself and tags that the toolkit matches with tags in render tables in order to select the appropriate fonts or font sets to display the text.

For editing text, Motif provides Text and TextField widgets. The displayed text in these widgets may or may not be editable, depending on the value of the XmNeditable resource. When the Text is editable and the user enters a text character, that character is inserted into the text. Other translations and actions allow the user to navigate or to select, cut, copy, paste, or scroll the text. In Text and TextField widgets, Motif represents text as strings of either multibyte ( char) or wide (wchar_t) characters. The Text widget uses a single font or font set from a render table to display the text.

This chapter discusses the Text and TextField widgets. Labels and their subclasses are discussed in Chapter 5; and compound strings, render tables, and localization of text are discussed in Chapter 11. It is also possible for an application to construct its own text-editing widget by using a DrawingArea. This is discussed in Chapter 15.


[ Previous | Next | Contents | Glossary | Home | Search ]