Hey Peter, I was just reading through your question and the answers and I noticed the solutions get sort of complicated. I think the reason is the task you're describing a little unusual. Having one keystroke, the return key, perform two very different actions can result in a non-intuitive UI. Consider, on a web page hitting the return key NEVER closes the page. In fact it open a new one.
I've inadvertently set up this sort of thing on forms of my own and it's really annoying. When I want to use the Return or Enter key for anything besides accepting the form (eg. initiating a query, moving around on a listbox, etc. ) I put an invisible button on the form to trap the keystroke and then post an event, typically a TAB. This way I can still trap in the current object. For adding a CR to a text field I enable the After keystroke form event and trap the keystroke there. With this setup you will still handle the query stuff in the context of the relevant object. I think someone else mentioned using the loosing focus form event. That's good because some users will probably get used to using the TAB key to move around. There's nothing to stop your code from reselecting the search input object when it looses focus. The user won't know the difference. But if you do that how does the user get out of the field? For closing forms, not alerts, confirms or requests, with a given key I like to decide on some consistent action and stick to it on every form. You could use Shift key + Enter. Whatever you choose matters less, I think, than applying it consistently throughout the database. On Fri, Nov 29, 2019 at 1:44 PM Peter Jakobsson via 4D_Tech < 4d_tech@lists.4d.com> wrote: > This is so that users can hit the return key to execute a query (like > Google style). But if the cursor is not in the filter field but > highlighting a row in the list then the return key should accept the form > (via regular default button action). > -- Kirk Brooks San Francisco, CA ======================= What can be said, can be said clearly, and what you can’t say, you should shut up about *Wittgenstein and the Computer * ********************************************************************** 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 **********************************************************************