mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 13:25:51 +03:00
[GH-ISSUE #198] Need help for showing two modal #156
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#156
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 @thedevsaddam on GitHub (Nov 29, 2018).
Original GitHub issue: https://github.com/rivo/tview/issues/198
I want to show two modal, the first modal with a message and after doing some task another modal:
Code
@rivo commented on GitHub (Dec 3, 2018):
The reason you don't see the first modal is that the screen is not automatically redrawn when you call
pages.AddPage().I've added
Application.ForceDraw()in the latest commit and you should call it after adding the first modal so it is shown to the user.Note that it gets more complicated if you use goroutines. For those scenarios, check out the Wiki.
@thedevsaddam commented on GitHub (Dec 3, 2018):
Though it shows the modal, but the second modal's button is not focusable.
Code:
@rivo commented on GitHub (Dec 3, 2018):
This was indeed a bug which I just fixed.
A few notes about your code:
ForceDraw()is not recommended in a goroutine. I wrote that in the function comments.tv2.GetFocusable()doesn't do anything in this context. It's an internal function anyway and not needed.app.SetFocus(pages)asapp.SetRoot(pages, true)already does that.Here's an updated listing:
@thedevsaddam commented on GitHub (Dec 4, 2018):
Thank you 👍 I really appreciate your reply with the solved code