Chapter 8. Editors

Using User Interface components for entering, displaying and editing data

Almost all applications display data and allow users to add new, or edit existing data items. Editors are a family of controls that Series 60 provides in order to handle these common requirements.

Editors, by necessity, offer a diverse range of behavior ”primarily because they must be able to handle numerous data types and formats. For example, they need to be able to handle phone numbers, text entry, floating-point numbers and so on. For each specific data type, editors may need to restrict certain input ” numbers should not be accepted, for example, if the editor has been configured to receive only text.

Also, some data entry formats may require other special characters , apart from the standard letters and numbers that users can intuitively access from the keypad ”for example, emails would require the at ("@") character to complete an address. Therefore, editor controls must also provide access to relevant additional characters. This chapter will show you how to configure editors in order to handle these various requirements.

Apart from handling data entry, editors also provide sophisticated text representations. Editors must be able to display, and allow input of, formatted alphanumeric data ”formatting that parallels the capabilities of contemporary word processor applications (bold, italic and underlined text; a variety of fonts; and so on). The Series 60 family of editors provides all of these facilities, and this chapter will explain and illustrate the techniques required to achieve these aims.

This chapter assumes a good grounding in the fundamentals of Symbian OS, and an understanding of how to create an application UI, using standard Series 60 architectures. Of particular importance is the use of UI component controls and resource files. If necessary, you should familiarize yourself with the material in Chapters 3, 4 and particularly 5.

The family of editors is divided into the following categories, each of which will be covered in turn :

  • Text Editors ” These allow single or multiline text. The most basic accept and display only unformatted ( plain ) text , but more specialized ones accommodate highly formatted ( rich ) text .

  • Numeric Editors ” These specialized text editors restrict input to allow integer, fixed-point and floating-point number editing.

  • Secret Editors ” These hide text as it is typed to provide secure entry of passwords and PINs (Personal Identification Numbers).

  • Multi-Field Numeric Editors (MFNEs) ” These are numeric editors that have one or more fields separated by data-specific characters. There are specialized MFNEs that allow the user to enter IP addresses, ranges, times, dates, durations and so on.

All of the topics covered in this chapter are illustrated using code excerpts, largely taken from example applications. Details of how to download the full buildable source for these, along with the other example applications, are given in the Preface. Some of the following topics can be amply explained without a comprehensive example ”in these cases the concepts are conveyed using illustrative code excerpts.

For clarity, the examples have been kept very simple ”their purpose is solely to illustrate how to use the editors programmatically. All examples use the Traditional Symbian OS Control-Based Architecture, rather than Dialog-Based or Avkon View-Switching Architectures.

The first example, PlainTextEditor , shows how to create and use a plain text editor in an application. Attributes are set on the editor such that the user could use it to enter a URL (Uniform Resource Locator) in an application.

The RichTextEditor example shows how to create and use a rich text editor, which has attributes set such that you could use it to display a help screen for a game application.

The final example, NumericEditor , shows how to create and use numeric editors in an application.

Developing Series 60 Applications. A Guide for Symbian OS C++ Developers
Developing Series 60 Applications: A Guide for Symbian OS C++ Developers: A Guide for Symbian OS C++ Developers
ISBN: 0321227220
EAN: 2147483647
Year: 2003
Pages: 139 © 2008-2017.
If you may any questions please contact us: