$doctitle = "Implementing Type-Ahead"; $authname = 'Liz. A. Woodhouse'; $attrinfo = ''; $audience = "1"; $versions = "Applies to: Paradox 5.0 and later"; $postdate = "15 September 2000"; $pagearea = 2; $navlinks = 'Paradox:'; // Define your META Keywords here $metakeys = "paradox objectpal type ahead search keyboard searching locate find"; // Define the META description here; should be a simple, short sentence $metadesc = "Shows one way to implement Quicken-style type ahead searching"; ?> // this block is required include( $DOCUMENT_ROOT . "/lib/pageinit.php" ); ?>
Answer: There are several possible approaches, depending on your needs and the specific design of your form. If you wish to use this to:
Simply locate values in a table, use an unbound field for typing your search criteria. As you type, use locate() to synchronize the associated tableframe or multi-record object (MRO) with the criteria.
You can use this approach to "auto-complete" the criteria field with matches when the user enters the table frame or MRO. You can also control the type of searching performed on the data. for example, you can use the criteria as the beginning of the target value (e.g. criteria..) or as a portion of the underlying value (e.g. ..criteria..).
Look-up values in a table, use a read-only instance of the lookup table in the data model and then use the data field to capture what the user types (and allow the backspace to delete from the end of the search criteria) - just like the built-in Table Lookup dialog does.
Locate similar records in the same table as you type a value for a new record, this needs to be handled differently so that you stay in the newly inserted record.
Other approaches are certainly possible, again depending on your situation, needs, and application design.
Generally, the code triggering the search goes into the keyChar() event of the object where you're entering the search criteria. Be sure to place this after the default behavior of the event (e.g. use doDefault as your first statement).
A demonstration of these techniques is available. Please note that it requires the Customer, Vendor, and Stock tables provided in Paradox's :Sample: directory.
If you haven't installed the sample files or cannot locate them, copies are available, though please remember to run the enclosed SetAlias script to define the :Sample: alias.
// this block is required include( $DOCUMENT_ROOT . "/lib/pagecomp.php" ); ?>