Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 6.1

COLUMN

In The Spotlight

Adding Spotlight-style searching to your app

Issue: 6.1 (November/December 2007)
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): 10,472
Starting Page Number: 44
Article Number: 6119
Related Web Link(s):

http://www.declaresub.com/code
http://developer.apple.com/documentation/Carbon/Reference/MetadataAttributesRef/index.html#//apple_ref/doc/uid/TP40001689
http://developer.apple.com/documentation/Carbon/Reference/MetadataAttributesRef/index.html#//apple_ref/doc/uid/TP40001689

Excerpt of article text...

Computers store information: memos, links to useful web sites, e-mails, pictures, music, movies, recipes, doodles, novels... the list can go on and on. Storing the information is easy, as long as there is enough disk space. Finding it, on the other hand, can often be a challenge.

In a REALbasic program, there's a pretty good chance that the interface will need to include the ability for the user to find something, and the "have the user scroll through the list" is generally not a good strategy, especially for lists that can get large. Even sorting the list alphabetically entails quite a bit of browsing on the user's part, and there is always a better way.

That better way is almost always allowing the user to search for a particular bit of text. In the ultra-responsive world of Mac OS X, the usual interface involves having matching items show up as the user is typing the string. And as with many other things in the Macintosh interface, Mac OS X has a consistent interface for doing searches: Spotlight, which is recognized by its familiar magnifying glass icon.

It is interesting to note that the Spotlight technology itself only finds files (for example, using the Spotlight menu in OS X 10.4); other search functions (like the Spotlight utility in System Preferences, or the search field in Safari) actually have nothing to do with the Spotlight technology. However, this is inconsequential to the average user, and having a consistent interface allows the user to easily find the search tools in any application.

Looking the Part

To take advantage of this consistent interface in your own application, you'll want to add a search field that has the look and feel of a Spotlight search field... but REALbasic does not have one available as a built-in control. Fortunately, Charles Yeomans does: his HISearch Field (for placing anywhere in a window) and SearchFieldToolbarItem (for placing in a standard toolbar, as in the Finder, Safari, or Mail) are available for download from his website: http://www.declaresub.com/code. These powerful classes allow you to set grayed-out text that disappears when the control has focus (which is the standard method for identifying the type of search that will take place), enable and modify the built-in menu (accessed by clicking the magnifying glass) and cancel button, and get and set many of the same properties as you would have in an editField. The classes don't require much in the way of explanation... they are easy to use, but their presence can add an incredibly professional touch to your application.

...End of Excerpt. Please purchase the magazine to read the full article.