[GH-ISSUE #259] There doesn't seem to be a way to remove buttons from a modal view #200

Closed
opened 2026-03-04 01:02:55 +03:00 by kerem · 3 comments
Owner

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

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
kerem closed this issue 2026-03-04 01:02:56 +03:00
Author
Owner

@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?

<!-- gh-comment-id:491825663 --> @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?
Author
Owner

@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.

<!-- gh-comment-id:492152068 --> @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.
Author
Owner

@rivo commented on GitHub (May 14, 2019):

I've added a ClearButtons() function in the most recent commit.

<!-- gh-comment-id:492271027 --> @rivo commented on GitHub (May 14, 2019): I've added a `ClearButtons()` function in the most recent commit.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#200
No description provided.