Two Questions About My Search Field

Devin Asay devin_asay at byu.edu
Tue Jan 13 10:06:45 EST 2009


On Jan 12, 2009, at 3:41 PM, Gregory Lypny wrote:

> 	Hello everyone,
>
> 	I've created a search field that takes a phrase typed into it and
> searches a data field for lines containing the phrase.  It works in
> the usual way where the search becomes narrower the more you type.
> What I haven't been able to do is go backwards, that is, make the
> search wider as characters are deleted from the end of the search
> string when the delete key is hit.  When the delete key is hit,
> nothing happens, and I'm not sure how to work a delete key message
> into the handler.
<snip>
Gregory,

I built stack a while back that incorporates this functionality. If  
you wan,t you can have a look at it by entering in the message box:

go stack url "http://asay.byu.edu/filterSearch.rev"

This example does more than just filter, hence the longer script. But  
it boils down to trapping the rawKeyDown message. The rest of the  
scripting does things like tabbing into the filtered list when you  
find your term, allowing arrow up and down to change selections in the  
list, placing the hilighted line in a field on return, and so forth.  
If it's helpful you're welcome to use it.
>
> 	My second question concerns the format of the field itself and the
> Geometry Manager.  I jazzed up the field by importing three PNG images
> to make it look like Apple's hot dog shaped search field.  The two
> rounded ends remain fixed in size and maintain their relative
> positions while the middle segment is scaled horizontally if the stack
> is resized.  It all works wonderfully (I believe Eric Chatonet gave me
> this tip ages ago --- thanks, Eric) except that whenever the stack is
> reopened the middle segment is displayed in its original size
> regardless of the size of the stack at the time it was closed.  This
> means the hot dog appears sliced until the user resizes the stack, at
> which time the pieces will snap back together.  Any fix for this
> little glitch?

Others may have a better solution, but I would try calling resizeStack  
on preOpenStack.

HTH

Devin

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the Use-livecode mailing list