Focus, Text and foundChunk
Ken Ray
kray at sonsothunder.com
Mon Oct 9 10:19:51 EDT 2006
On 10/9/06 7:35 AM, "Richmond Mathewson" <geradamas at yahoo.com> wrote:
> Not being satisfied with selecting individual letters
> inside text fields I have started playing around with
> FOUNDCHUNK and ended up with something that is "a bit
> of a bother":
>
> http://members.maclaunch.com/richmond/Text
> Focus.rev.zip
>
> first click on my button "Select String" and it does
> exactly what is required!
>
> click again on the button to generate an error
> message!!!!
This is because each subsequent "Find" you issue will try to find the next
occurrence of the text you're looking for. Since your code is:
on mouseUp
find "eating" in fld "F1"
select the foundChunk
end mouseUp
The second time around, it can't find anything and 'the foundChunk' is
empty. So when you try to do a 'select' with nothing in 'the foundChunk' you
get an error. Change your code to:
on mouseUp
find "eating" in fld "F1"
if the foundChunk is not empty then
select the foundChunk
end if
end mouseUp
and you won't have any problems...
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list