What I’m trying to do:
Prevent users from double-clicking my buttons and links. This is a habit of some users, outside of my control. (Complain to Microsoft as to how they got into this habit.)
Double-clicking activates most links/buttons twice, which does not always end well. This should be treated as a single-click, unless specified otherwise.
I have hundreds of links and buttons, so adding code to every single one of their event-handlers is not an attractive solution.
If there’s no global solution, I might try creating a decorator (proposed name: @debounce) to do the job. If the same event is triggered more than once within a second or so, it would ignore the second triggering. I’d still have to use it in over a hundred places, but it’s better than coding it longhand.
Patching the Button class this way is something I don’t normally think of, coming from a C++ background. Thanks!
And I could revert to the decorator approach if my app needs finer control. With some links/buttons, for example, it might suffice simply to disable the control until the handler returns.
Edit: Luckily, this problem has reared its head in only one spot in my code, so I was able to keep the scope of the change very small. But I’ll keep this tactic on hand, for worse cases.