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 5.3

REVIEW

HISearchField

Issue: 5.3 (March/April 2007)
Author: Toby Rush
Article Description: No description available.
Article Length (in bytes): 3,612
Starting Page Number: 8
Article Number: 5303
Related Web Link(s):

http://www.declaresub.com/

Full text of article...

The OS X Spotlight-style search field is an attractive control missing from REALbasic's suite of built-in controls. Long-time REALbasic developer Charle Yeomans' solution, HISearchField, is sleek, functional, and designed with both the end user and developer in mind.

HISearchField provides all the standard and optional features of these controls: the Spotlight magnifying glass icon along with its optional menu, the cancel button (an X in a grey circle at the right end of the field), and descriptive text that appears in the absence of any user-provided search terms.

Everything is implemented in a way that very nicely complements REALbasic's built-in controls. The field itself has the following as gettable and settable properties:

CancelButton as Boolean - for showing/hiding the cancel button

SearchIcon as Boolean - for showing/hiding the magnifying glass icon

DescriptiveText as String - the grey text that displays when the field is otherwise empty

Text as String - the contents of the field

SelLength as Integer, SelStart as Integer - the placement and size of the current selection

The field also provides the property HasFocus as Boolean to indicate when the field has the focus.

HISearchField allows the user to write code for most of the same events as a normal editField (TextChanged, GotFocus, and LostFocus) as well as some that are specific to the search field: Cancel, which fires when the user clicks the cancel button in the control; MenuItemSelected, which fires when the user chooses a menuitem in the optional popup menu; and TextAccepted, which fires when the user presses return or enter in the search field (or changes the focus away from it).

The optional menu is provided by means of a separate (but included) object, the MacMenu. This object, accessible through HISearchFIeld.Menu, provides a popup menu with more capabilities than the built-in PopupMenu control provided by REALbasic, including styles for individual menu items and indented menu items.

Perhaps the best aspect of HISearchField is that while the entire control is written in REALbasic, everything is toolbox-based, so the interface matches the appearance and speed of search fields in applications like Safari, iTunes, or even the Finder itself. The control blends beautifully into the window in which it's placed, requiring only that the window's composite property be set to "true."

Equally attractive is HISearchField's price -- free -- which is a very good deal considering the capabilities provided by this control.

End of article.