mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 13:55:51 +03:00
[GH-ISSUE #360] Modal buttons: Reset to buttonIndex = 0 ? #269
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#269
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 @triddell on GitHub (Oct 30, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/360
Thanks for tview! I'm now getting back into a project I worked on months back and am very much enjoying this library once again. However, I have an issue that I can't seem to get past.
I'm implementing a modal dialog with text like
Warning: Bad things may happen... are you very sure you want to continue?And the buttons would readNo way!andOf course, I've got this!However, the modal dialog is remembering the last selected button index! So if on one attempt,
Of course, I've got this!is chosen, then the next time the modal dialog is shown,Of course, I've got this!is the default value! And with only two buttons displayed, it's hard for the end user to know which button is actually highlighted.Is there a way to reset the buttonIndex to 0 when redisplaying a model dialog? I believe you added
form.SetFocus(0)support to forms for a somewhat similar issue.@millerlogic commented on GitHub (Nov 4, 2019):
I'd also like to be able to set which button I want initially focused. Perhaps a
SetButtonFocus(index int)?@triddell commented on GitHub (Nov 5, 2019):
I just added PR #364 which resolves this issue for me. Please accept or modify as necessary. Thanks.
@rivo commented on GitHub (Nov 27, 2019):
I provided the change myself, mostly because you copy&pasted the function comment from
Formwhich didn't make much sense inModal's context. Anyway, this should be resolved now.