intercepting return key after find()

Questions and answers for designing and implementing forms in Servoy

intercepting return key after find()

Postby amcgilly » Wed Mar 28, 2012 11:38 am

I am using Servoy 5.2.11.

I have forms that are nested 2 levels deep in tabpanels. On all of these forms I have a find button that puts the form in find mode. I also have an OK button that performs the controller.search() as well as some UI stuff. When I hit the OK button everything works fine. I want it so that when the user hits the return key on the keyboard, that too will call my search method. I have tried attaching that search method to the form's onSearch event, but strangely that doesn't always work. On some forms it calls my search method. On others, it just performs the search without calling my method. I've compared the forms and their search methods and I see nothing that explains this difference in behavior.

I do have "controller.search()" in my search method. I know that is a requirement in order for Servoy to call your method while in find mode. That doesn't seem to be helping. Does anyone know how I can get Servoy to call my method when I hit return? Thanks.
Adrian McGilly
Servoy Developer

Image
amcgilly
 
Posts: 375
Joined: Fri Dec 09, 2005 12:03 am
Location: San Francisco, CA

Re: intercepting return key after find()

Postby amcgilly » Wed Mar 28, 2012 7:07 pm

This morning I solved my problem, with a little help from this thread:

https://www.servoy.com/forum/viewtopic.php?f=2&t=16501

That thread talks about the need to set the onSearch property to "none". I had done that on the form, and on all container forms (i.e. forms that contained it via tabpanels), and it still wasn't preventing the search from taking place when I hit the return key. But what I realized this morning is that onSearch has to be "none" for ALL FORMS THAT ARE DISPLAYED, incuding forms in any neighboring tabpanels on the same main form. I had a couple navigation-related forms sitting in tabpanels on main (top-level) form and their onSearch was still set to DEFAULT. Once I set their onSearch properties to "none", the return key stopped triggering the search and now I'm a happy camper and so is my client.
Adrian McGilly
Servoy Developer

Image
amcgilly
 
Posts: 375
Joined: Fri Dec 09, 2005 12:03 am
Location: San Francisco, CA


Return to Forms

Who is online

Users browsing this forum: No registered users and 12 guests