Re: keyDown idiosyncricies

Scott Raney (raney@metacard.com)
Wed, 29 Nov 1995 20:16:23 -0700 (MST)

> > > I would like to implement an incremental search type thing in MetaCard.
> > > I would have two fields, the first field is the first to search in, and
> > > the second field is the incremental search input field.
> > >
> > > Anyone who has used emacs (Control-s) knows what I want.
> >
> > This feature can be found in the 2.0 script editor. Coincidentally,
> > the second alpha-test release of 2.0 has just been released, and can
> > be acquired via anonymous FTP from ftp.metacard.com:/MetaCard/2.0.
> >
> > on keyDown which
> > switch
> > case searching
> > #### here's the important line for entering the character
> > put which after field "Buffer"
> > doselect
> > break
>
>
> Yea, but this doesn't do backspace or delete. Let's say I want to
> search for eml, but type emp; now all I want to do is hit delete or
> backspace, and then type p.

The 2.0 script editor does these things, you just have to handle the
backSpaceKey and deleteKey messages (I removed them from the script I
posted to save space and avoid confusion).

> Also, let's say I searched for "Happy Days
> are here again", and now want to search for "Days are here". It would
> be natural to select the word "Happy", press delete, select "again",
> press delete.

I don't know how *you* use Emacs, but I almost never type more than 1
word. And it's never occured to me that the inability to edit the
search string (other than using backspace or delete) is a shortcoming.

> Why do I have to give up the usefulness and functionality of the entry
> field?

To be compatible with Emacs? ;-)

Back to your original post, though. It sounds like you want to have
the cursor in two fields at the same time, which is impossible. So
you have to make a choice: either put the cursor is in the search
string field and mark the found text by hiliting in the field to be
search (e.g., setting the textColor of the found string), or, you use
the design used by Emacs and the 2.0 script editor. The latter is
much easier to implement since you can just move the text cursor
(using the select command), but you also have to give up the ability
to edit the search string.

Your original questioned concerned the first type of implementation,
where you wanted to find the text *after* the character was entered
into the field. Why not just put the character into the field in the
script, then search, and then not pass the keydown message?
Scott

> --
> Earle Lowe
> emlowe@fsa.ca
> FSA Corporation
> Performance and system software for UNIX networks.

-- 
***********************************************************************
* Scott Raney  303-447-3936            Remember: the better you look, *
* raney@metacard.com                   the more you'll see -- Lidia   *
***********************************************************************