Article Preview
Buy Now
| Print: | |
| PDF: |
Interface Design
Getting Your Auto-Fill
Extending the EditField control
Issue: 3.2 (November/December 2004)
Author: Toby Rush
Author Bio: Toby Rush is a music instructor, consultant, freelance programmer, web designer, husband and Dad in Greeley, Colorado.
Article Description: No description available.
Article Length (in bytes): 8,977
Starting Page Number: 44
RBD Number: 3221
Resource File(s):
3221.sit Updated: Friday, November 19, 2004 at 9:21 AM
Related Link(s): None
Known Limitations: None
Excerpt of article text...
One of the new interface elements that has emerged over the past half-decade or so is the auto-completing EditField, which analyzes what is being typed and, if it matches the first portion of an item from a list, completes the typing for the user.
These gadgets first became popular in web browsers, where they allow users to just type the first portion of a URL that they had recently visited. Apple uses this type of EditField in many programs, most visibly iTunes and Mail.
This is the type of thing that's screaming to be a subclass in REALbasic: an extension of an existing control that provides some extra features. We can subclass REALbasic's EditField class pretty easily -- the process will involve adding an array of strings to serve as the list, and the coding to make it do lookups and autocompletions.
Implementation
Different programs implement this type of control in different ways; one fairly popular method (and one well-known to REALbasic users) is to have the text which the user hasn't typed appear in grey or some other pale color. For this exercise, we'll use the implementation that Apple uses: the rest of the string is supplied in normal color text, but is selected. This is very consistent and sensible; it is normal behavior for selected text to be replaced by whatever is typed next. It will also be a little easier to implement, since we won't need to deal with styled text!
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|










