Type Ahead code sample


What is it: TYPEA is a form which demonstrates various ways of using 'type ahead' code.


Credit: All work done by Liz A. Woodhouse.  Feel free to send comments, suggestions, bug reports to Liz at: law@aros.net.  SEE END OF FILE FOR TERMS/DISCLAIMER/COPYRIGHT.


Instructions/features: Extract the form to any form or directory.  Make sure you have the :Sample: alias and its tables as included with Paradox.  Run the form and follow the instructions for each of the three boxes (each representing a different search type).  All searches are case insensitive (this can be changed in code).  In all cases, if there's no match for the search criteria, the last character typed is removed and the computer beeps.  The examples also demonstrate how to allow spaces in your search criteria (a space before a .. wildcard is not allowed - or returns no results).

The first box demonstrates searching for values in a tableframe using an unbound field to type in search criteria.  Options are to search for values which start with the search criteria or to search for values containing the search criteria anywhere in the field.  With this last option, a 'Locate Next Match' button allows you to find the next record with a match.

The second box demonstrates searching a field in a tableframe (whose table is read-only in the data model) by typing in the field you're searching.  This is how the built in table lookup dialog behaves.  It also demonstrates the difficulties of searching on number type fields (which have thousands separators and decimals).  Changing the field object's display properties to Integer or to a format without the thousands separator does not eliminate these problems.

The third box demonstrates populating a field in a new record by searching the same field in the same table for values which start the same as what's been typed thus far.


Developer Notes: This form can be placed in any directory or alias, but relies on the :Sample: alias and its tables as included with Paradox.  See code comments for ways to customize the type ahead behavior.

This form uses a custom style sheet which is included.  The style sheet includes code for certain objects which sets their color to the Windows 3D control color for the user's color scheme (making the form adhere - at least in part - to the standard Windows behavior).  This code has been commented in the TYPEA form, but not in the style sheet.  The style sheet also sets the font for text and field objects to MS Sans Serif 8pt - the Windows default, and has display properties set for various objects to come as close as possible to the Windows standard.

This form also includes coincidental code which may be of interest - such as how to use an unbound checkbox to enable/disable another object.


Disclaimer/Terms: This information and associated files (TYPEA.FSL, TYPEA.TXT, WINFORM.FT) and code are provided free of charge for any legal use or activity.  Illegal use is strictly prohibited and you are solely responsible for such actions.

All files, information, and other data provided with this file are provided as-is with no implied or explicit warranties of any kind whatsoever.  While I make good-faith efforts to provide accurate information, you should always verify my findings before incorporating this information into your own projects and processes. You are strictly and solely responsible for your use of this information. If you damage your system, data, reputation, ability to work, mental stability, or any other material (or immaterial) asset while using the information in this file or the files included with it (XUSERS.TXT, XUSERS.FSL, WHOHAS1.BAT), it is your responsibility. Practice safe computing--make a backup!

This file and the files included with it may be redistributed freely under the following terms: All files must be included (this means: TYPEA.FSL, TYPEA.TXT, WINFORM.FT), this text file may not be altered (include your own file if you wish to include additional information), you may not charge anyone any kind of fee (monetary or otherwise) for this file or its associated files, and credit must be given to the author of these files (leave the cmCredit() method in place).

If you wish to make commercial use of this file or any of its associated files, please contact the author via the email address given at the start of this file.

Copyright 2000, Liz A. Woodhouse.  All rights reserved.
