Possible to disable Enter key in find mode?

Is it possible to disable/inactivate the Enter key in find mode? I want my user to be able to start a search only by pushing a particular button (because I am processing the contents of the form fields before starting the search) and not by hitting the Enter key (which can easily happen with inexperienced users).

Thanks,

Jochen

Why not just hook up the script that you want to run to the enter key action?

In Servoy, there’s no way to trap for a keypress (in the native application - you can do it with Java and creating your listeners) - but you CAN control what happens when the form searches.

On your form - double-click on the event “onSearch” - click “Create Form Method”. Then view the script of the form (right click and choose “Open in script editor”). Call your method from the “onSearch” method and it will trigger when they hit the enter key in find mode.

Thank you, Bob. That would probably allow me to make sure that my script runs before the search is performed, but it would not prevent starting a search prematurely when inadvertently hitting the Enter key while filling out multiple fields. Thus, my preference would still be to disable the Enter key, but it sounds like it is impossible to break the link between hitting the Enter key and starting the search.(?)

Jochen

I’m doing this out of my head, but can’t you just check, if you activated the onSearch() script by the Enter key or by a button… (like setting some variable when you fired it from a button) and if the variable is not filled, you say, return false?

again, not sure, if: return false
works for onSearch…

wouldn’t it just work if you overwrite onsearch and do nothing, and then when the button is pressed you do you search?
As far as i know onsearch event is only triggered by the UI not when you do it through scripting…

Thanks for the tips! It is actually as easy as just calling an empty method when onSearch is triggered. I didn’t think of that because my expectation was that onSearch would just call a method that is being executed before Servoy starts the search. I didn’t expect that the search itself would be started by the method…

jditte:
Thanks for the tips! It is actually as easy as just calling an empty method when onSearch is triggered.

You can also set the onSearch event to “none”, then you don’t need an empty method.

There’s some useful additional info about this issue in this thread:

viewtopic.php?f=2&t=17989