Paste no closeField

Bob Sneidar bobsneidar at iotecdigital.com
Thu Mar 10 17:53:35 EST 2022


hi all. 

I have been seeing that when pasting text into a field then exiting the field, closeField is not getting sent to that field. Here are a couple handlers for your frontScript to deal with that. It only works with fields whose name begins with "old" otherwise this would trigger the script editor field and editable datagrid fields, and really slow things down. 

/*
If a user pastes something into a text field, then leaves the field, closeField is not triggered. These two handlers 
are the workaround for that. Only fields beginning with "fld"  are considered. 
*/
on openField
   put long id of the target into pField
   if char 1 to 3 of the short name of pField is not "fld" then \
         pass openField
   set the savedtext of pField to the text of pField
   pass openField
end openField

on exitField
   put the long id of the target into pField
   if char 1 to 3 of the short name of pField is not "fld" then \
         pass exitField   
   if the text of pField is not the savedtext of pField then \
         dispatch closeField to pField
   set the savedtext of pField to empty
   pass exitField
end exitField

Bob S


More information about the use-livecode mailing list