Using XOJO 2013 R3
I´ve some Windows with textfields. The windowtype is Document.
Stepping trough the field with TAB works fine.
BUT using the ENTER-Key in a field is closing the window and opens another window.
Does anyone have an idea how to use ENTER for stepping like the 'TAB or preventing for closing the Window.
Thanks for you help
Catch the key in the KeyDown event, and in case the key is ENTER set the focus yourself and then return True so that no further processing is done.
You might want to, put some code (maybe a system.debuglog) in the window.close event and put a break point on it to see what is calling the close event. Pressing Enter in a textfield will not cause the window to close, so obviously pressing ENTER in you app is triggering something you aren’t wanting it to trigger and that closes the window. You probably need to fix that.
I winder if maybe you have a default button on your form, that calls Self.close. And you shouldn’t (mis-)use the enter key to set the focus. That’s the tab-key’s job.
Thanks for the quick answers.
We found that on opening the window the first bushbutton has the focus.
Stepping trough the textfields doesnt change the focus.
For the moment the solution is that we created a button with tabindex 0 with no action.
So enter can´t start the Action of the button with the focus.