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

Enable Close/Quit/Collapse/Expand buttons on `Border`

Open drweb86 opened this issue 2 years ago • 2 comments

Mini-Spec

Three scenarios so far:

  • User clicks on a button in the Border (top/right) that causes a Modal to quit.
  • User clicks on a button in the Border (top/right) that causes an Overlapped to close/hide.
  • User clicks on a button in the Border (top/right) that causes the view to collapse/expand.

We will create 3 new View subclasses, one for each of these:

  • ApplicationQuitter - Glyph is an X. MouseClick, and KeyBinding (Space) invoke Command.QuitToplevel (to be renamed to Command.Close). The command handler simply calls Application.RequestStop().
  • ViewHider -  Glyph is an X. MouseClick, and KeyBinding (Space) invoke Command.Close. The command handler simply calls SuperView.Parent.Visible = false. (or perhaps we add Close() as a verb on View?).
  • ViewExpander - Glyph is a up/down arrow. MouseClick, and KeyBinding (Space) invoke Command.ToggleExpandCollapse. Command hander
    • Disables/Hides/Enables/Shows SuperView.Parent's subviews
    • Sets the Height of the SuperView.Parent to 3 or Dim.Auto

Devs will add these views via view.Border.Add.

This is what ViewExpander will look like/do:

9rGXIUs 1

I've built a POC of ViewExpander in #3376

Background

This is a sub-issue of:

  • #2994

Will be fixed in this PR as a proof:

  • #3278

Background

Is your feature request related to a problem? Please describe. I want user to be able to close button by [X] button near dialog title from top right side. And I want them to be shown in Query dialogs by default. Because when you pass no button its not clear, that you need Escape button to be pressed to close it.

Describe the solution you'd like For dialogs and querries to have [x] button: Dialog Title [x]

Describe alternatives you've considered Have close button as now.

drweb86 avatar Aug 16 '23 11:08 drweb86

I remember a long time ago, to add [ Ok ] button on MessageBox if no buttons are provided on the parameters, but wasn't accepted at the time. I really don't like when there is no button at all, but also I think if it's only to close the dialog it isn't need to explicit add a button in the parameters. Good luck :-)

BDisp avatar Aug 16 '23 12:08 BDisp

This will be easy to accomplish in v2 once adornments are full implemented.

tig avatar Aug 16 '23 12:08 tig

Closing as dupe of #3407

tig avatar Aug 13 '24 21:08 tig