how to activate a button when it has the focus

I’m on a Mac here:

what is the needed code so when you TAB around your interface, and a button gets the focus and gets the blue box, when you hit ENTER, code for the button does its thing.

thanks

You need to allow full keyboard access in the Keyboard preferences / “Shortcuts” tab / Check “All controls” for the Mac UI to behave like that.

If you want to obtain that without the user having to set the preferences, you will need to implement a workaround so tab can stop on buttons (which it normally does not do). One of the simplest way is to place each button over a canvas which will show the focus ring and be able to have a tab stop.

Then in the canvas KeyDown event, use Pushbutton.Push when key = chr(13)
http://documentation.xojo.com/index.php/PushButton.Push

cool, lets give it a try

Have you tried setting the Default property to True?