I have a general question that has popped up occasionally in my program. Most of the time, when I set a desktop button as default, pressing the ENTER or RETURN key sends the command to the button, and the “Pressed” event takes place.
However occasionally, the control does not go to the desktop button and pressing the ENTER key does not execute the Pressed code. When that happens, clicking on the button makes it behave as intended, as I would have expected the ENTER key to do.
I realize I am likely doing something to cause that, and have made workarounds in my code to deal with it, but I can’t understand why the [desktopButton1.default = True] isn’t absolute in every instance. Where is the control being directed if the button default doesn’t work as expected?
One possibility is if you are capturing the Return/Enter key elsewhere in your code. For instance if you have a KeyDown handler somewhere and just blindly return True to day “I’m handling it”. Another possibility is if you made a menu item whose key is Enter or Return with no modifier key.
Jared, thanks for the response. Your comment makes some sense in looking at my code - I will have to experiment with it. I see where when all the text fields are used up on a form in my program, I send a warning message to the screen. I’ll have to see if that is failing to surrender the focus from the last entry text field.
Somehow, for programmers like me with only modest experience, it would be great if Xojo could capture the things similar to your comment and put them into a place where they could be searched.
Greg, not a menu item issue. I don’t think there are any instances with the return statement in earlier code, but I will look for that, too. Thanks for answering so quickly.