Staying on a field

Bill Vlahos bvlahos at mac.com
Wed May 4 03:17:19 EDT 2011


Terry,

Thanks this works. I also discovered that I can replace "focus on me" with "select the text of me" in my script and that works too.

If the closeField message comes as a result of going to another card then I get the dialog but it still goes to the new card anyway so the dialog doesn't really work if the user wants to try it again.

Bill Vlahos
_________________
InfoWallet (http://www.infowallet.com) is about keeping your important life information with you, accessible, and secure.

On May 3, 2011, at 9:40 PM, Terry Judd wrote:

> On 04/05/2011 02:14 PM, "Bill Vlahos" <bvlahos at mac.com> wrote:
> 
>> on closeField
>>   if me is not a date then
>>      answer error "Not a valid date. Retry?" with "No" or "Yes"
>>      if it is "Yes" then
>>         focus on me
>>         exit closeField
>>      end if
>>   end if
>>   pass closeField
>> end closeField
> 
> Bill - how about this?
> 
> on closeField
>   send checkMe to me in 0 millisecs
> end closeField
> 
> on checkMe
>   if me is not a date then
>      answer error "Not a valid date. Retry?" with "No" or "Yes"
>      if it is "Yes" then
>         focus on me
>      end if
>   end if
> end checkMe
> 
> Works fine if you're tabbing between fields but if you click on the card
> then the focus will stay with the field no matter what, whereas what you
> probably want to do (if you choose 'no') is to focus on nothing.
> 
> Something like this maybe...
> 
> on checkMe
>   put the selectedChunk into tSelection
>   if me is not a date then
>      answer error "Not a valid date. Retry?" with "No" or "Yes"
>      if it is "Yes" then
>         focus on me
>      else
>         if tSelection is not empty then
>            select tSelection
>         else
>            focus on nothing
>         end if
>      end if
>   end if
> end checkMe
> 
> HTH,
> 
> Terry...
> 
> --
> Dr Terry Judd | Senior Lecturer in Medical Education
> Medical Education Unit
> Melbourne Medical School
> The University of Melbourne
> 
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list