mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[GH-ISSUE #259] There doesn't seem to be a way to remove buttons from a modal view #200
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#200
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @urandom on GitHub (Apr 4, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/259
Hello,
I've noticed that there isn't any way to remove buttons from a modal view. This presents a problem, since the method for adding buttons to a modal appends the buttons to the already existing list, so there isn't any to actually change the buttons, except for scrapping the whole modal and creating a new one.
I've prepared a very simple change that adds a method for clearing the buttons:
https://github.com/rivo/tview/pull/257
@rivo commented on GitHub (May 13, 2019):
I'd like to understand your use case a bit better first. Are you looking to remove individual buttons? Your pull request removes all buttons but in your program, do you then re-insert new buttons afterwards?
When you remove all buttons, how do you close the modal? Shouldn't a modal have at least one button?
@urandom commented on GitHub (May 14, 2019):
I'm looking to reuse the modal dialog itself, and so far the buttons are the only things that cannot be changed. I have a few different cases that need modal dialogs with various buttons - there might be buttons that are present in multiple dialogs, but that really doesn't matter. The use case is to clear the current set of buttons and add a new set.
The change is not strictly about leaving the modal without buttons, though even the current API will not prevent you from doing that.
@rivo commented on GitHub (May 14, 2019):
I've added a
ClearButtons()function in the most recent commit.