Staying on a field
    Terry Judd 
    tsj at unimelb.edu.au
       
    Wed May  4 00:40:36 EDT 2011
    
    
  
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
    
    
More information about the use-livecode
mailing list