I have a field on a form that triggers a method when focus is gained, called onFocusGained(). I also have a method on the form that is triggered when the form is loaded, called onLoad().
Inside the onLoad() method I am calling controller.focusField(myfield,false) because I would like my field to get the focus immediately on startup. However, the field does not appear to be getting the focus and the onFocusGained() method is not getting called. I do know that onLoad() is executing because I put info dialogs at the start and end of the method.
Any ideas why focusField isn’t working? I’m on Servoy 5.1.
I have removed the dialogs except from the onFocusGained() method. Still no luck. I also tried calling onLoad() from the onShow event. That didn’t work either.
It seems that focusField() just isn’t working at all, no matter where or how I call it.
This is odd. Before creating the button for the test you suggested, I deleted the field and re-created it. Then I added the button and called focusField from there, and it worked. I also then re-added the call to focusField in the onShow on the form, and it works now too!
I had triple-checked the name of the field before deleting it, so I really don’t think that was the issue. I’m thinking something must have been “messed up” behind the scenes and deleting/recreating the field fixed it.