Two Questions About My Search Field

BNig niggemann at uni-wh.de
Mon Jan 12 19:01:45 EST 2009


hi Gregory,

try this in the script of your search field:

on keyDown pKey
    if pKey = "tDelete" then
        put char 1 to -2 of me into searchString
        put searchstring into me
        select after text of me
        if searchstring = "" then
            put "" into field "Number of Records"
            put "" into field "Browse List"
            exit keyDown
        end if
    else
        put me & pKey into searchString
        put searchstring into me
        select after text of me
    end if
    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

on rawKeyDown pKeyCode
    if pKeyCode = 65288 then send "keyDown" && "tDelete" to me
    else  pass rawKeyDown
end rawKeyDown

I dont pass the keyDown, it works for me, maybe you find a need for it and
you would have to tweak the script a bit.
regards
Bernd
-- 
View this message in context: http://www.nabble.com/Two-Questions-About-My-Search-Field-tp21425489p21426769.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list