> Le 30 nov. 2019 à 22:58, Peter Jakobsson via 4D_Tech <4d_tech@lists.4d.com> a 
> écrit :
> 
> Thanks for that input Chip.
> 
> However I don’t see how this can work. How can the invisible button script 
> know which field the cursor was in last ? (Or which object last had the focus 
> prior to its own script being executed ?)

Hi Peter, 
correct me if I'm wrong, I understand you want to trap return key when focus is 
in a specific input zone only? If so, I'd do like this:

- have a button "btTrapReturn" with the shortcut return (an invisible button 
type should be ok), set to "invisible by default" (property)

- input zone object method
case of
 :(on getting focus)
  set btTrapReturn to visible //the shortcut works
 :(on loosing focus)
  set btTrapReturn to invisible //the shortcut doesn't work
end case

Note: 
I recommend you to set the shortcut by code, like this
  OBJECT SET SHORTCUT(*;"btTrapReturn";Shortcut with Carriage Return)
why: I don't know if it's still true, but I noticed such shortcuts worked 
better than those set by properties when the final user's keyboard is different 
from the developer's one (for example pc/mac, or with/without numeric pad…)

-- 
Arnaud de Montard 


**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to