Two Questions About My Search Field

Terry Judd tsj at unimelb.edu.au
Mon Jan 12 18:07:58 EST 2009


On 13/01/09 9:41 AM, "Gregory Lypny" <gregory.lypny at videotron.ca> wrote:

Hi Gregory,

Perhaps you should look at implementing a rawkeydown handler as well or
instead of the keydown handler. That way you should be able to trap for any
key.

On the second issue - I think all you need to do is set the lockloc of the
image to true. It should then retain its size.

Terry...

> 
> 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.
> 
> on keyDown pKey
>     put me & pKey into searchString
>     get fld "Data"
>     repeat for each line thisLine in it
>        if searchString is among the words of thisLine
>        then
>           put thisLine & return after hits--Whole words
>           next repeat
>        else
>           if thisLine contains searchString then put thisLine & return
> after otherHits
>        end if
>     end repeat
>     put otherHits after hits
>     if the last character of hits is return then delete the last
> character of hits
>     put hits into fld "Browse List"
>     put 1*the number of lines in hits && "records" into fld "Number of
> Records"
>     pass keyDown
> end keyDown
> 
> 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?
> 
> Regards,
> 
> Gregory
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list