I hate to complain, but I'm not terribly impressed at the documentation for utilizing binding, it covers quite a bit but not common stuff, or maybe I'm just missing it. I was wondering how I could make the <RETURN> key equivalent to a <BUTTON1> click when a button is highlighted (from being tabbed over to, such as in the case of a search button. Also how would I make this work for multiple buttons, or even if the user hit <RETURN> in the Entry field? Ideas? I'm sure this one is way easier than it seems.

Recommended Answers

All 4 Replies

Isn't that done normally by SPACE by the window manager?

Haven't heard of this, do you have an example?

You would bind <TAB> to a function that would set the focus to the next button. The program would then know which button the <RETURN> should be bound to. See the examples at this page. The program becomes more complicated if you also want to include a button click to set the focus. You would have to then bind <Button-1> to a function that determines the location of the mouse and sets the focus, also allowing the program to know that the <RETURN> is in an entry box or where ever.

Haven't heard of this, do you have an example?

Try it out tab to some button in any dialogue, like 'Save as' and push space.

Enter should do the default action of dialogue, ESC should do same as Cancel button.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.