Terminal.Gui icon indicating copy to clipboard operation
Terminal.Gui copied to clipboard

Add `Accepted` Event

Open tig opened this issue 9 months ago • 2 comments

          > Hmn, so do I understand correctly that it is a new requirement for all button click handlers is for user to e.cancel in the handler? Otherwise any default buttons nearby may get click handler (now called Accepting) called?

Correct.

Note, previously, e.Handed/e.Cancel actually did either nothing or was non-deterministic. So while it was "easier to use" it was actually deeply broken.

We should double check there are no IsDefault issues with our existing dialogs like MessageBox and the Query one - if they have defaults we will need this new esc bit

I already did this when I implemented all this.

I also think this is going to be confusing for new users. But happy to merge and see how it goes.

The crux of this is the making Accepting universal and getting rid of explicit Clicked events.

Things are now super consistent and deterministic, but there IS a bit of mental load required to "get it".

I'm happy to discuss ways of mitigating this. Thots:

  • Add an Accepted event that is raised AFTER and can't be cancelled.
  • Re-introduce Clicked. I hate this idea.

Others?

Originally posted by @tig in https://github.com/gui-cs/Terminal.Gui/issues/3921#issuecomment-2686019437

tig avatar Feb 26 '25 19:02 tig

I agree with the first option for universal views.

BDisp avatar Feb 26 '25 21:02 BDisp

FWIW,

MenuItemv2 etc now implement Accepted in v2_develop.

tig avatar Mar 29 '25 17:03 tig