How do I control what fires when the Enter key is pressed on the keyboard?
In my WebSearchField, when I press Enter, naturally this fires the WebSearchField Press event. However, it also fires the Press event of another button on the WebPage straight after the WebSearchField Press event call.
Anyone have any idea why it’s doing this?
It’s supposed to be doing this so that you can Enter can submit something like a login form without needing a round trip to the server.
I had thought it was parent control related, as in if you put everything onto a Rectangle, the Default button would only act if you pressed enter in one of the fields also on the rectangle.
If you’re finding that the search field and default button don’t have the same parent control, you may be experiencing a bug.
All sorted thanks! I hadn’t realised exactly what the Default property of a button was doing; I assumed it was button style related but turns out I confused it for the the indicator property which also has a default option.
So clicking enter in a WebSearchField will always fire its Press event. In addition, if there is a Default button in the WebPage, it will also fire the first one. This is a little strange behaviour, as you wouldn’t normally want a button to be pressed in addition to doing a search from a WebSearchField (which already has its own search button). My feeling is that if Enter key is pressed from inside a WebSearchField, it should ignore all WebButtons with Default set to True.