Autofill Utility
Richard Gaskin
ambassador at fourthworld.com
Thu Jan 23 20:57:43 EST 2020
Nicely done, Bob. Thanks for posting that.
--
Richard Gaskin
Fourth World Systems
Bob Sneidar wrote:
> Hi all.
>
> These scripts may help you if you want to autofill text in a field from a list of prior values. The rawKeyUp handler goes in the field, and the autofill can go anywhere in the message path. You can see how simple this is.
>
> The prerequisite is to have a uniquevalues propery in the field. I have another handler if anyone is interested, which upon openCard queries a database for unique values for a list of fields, and then populates each field's uniquevalues property with the results, but I hesitate to put that handler here because it uses calls to sqlYoga, and some don't use that.
>
> Enjoy!
>
> Bob S
>
> ON rawKeyUp
> IF the text of me is not empty THEN
> autoFill the long id of me
> exit to top
> -- focus on me
> END IF
>
> pass rawKeyUp
> END rawKeyUp
>
> on autoFill pTargetID
> put the text of pTargetID into tText
> put the number of chars of tText into tCharCount
> put the uniqueValues of pTargetID into tValueList
> put lineOffset(tText, tValueList) into tOffset
> if tOffset = 0 then exit autoFill
> put line tOffset of tValueList into tNewValue
> if tText is tNewValue then exit autoFill -- in case we tabbed
> set the text of pTargetID to line tOffset of tValueList
> select char tCharCount +1 to -1 of pTargetID
> end autoFill
More information about the use-livecode
mailing list