mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #355] Question about Pages.SetChangedFunc() callback #265
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#265
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 @pktgen on GitHub (Oct 17, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/355
When I set the callback I do get the callback when a page changes focus. My question is what can I do with the callback as I do not seem to have any context as to what page changed. It seems like the callback should be passing in a values(s) to allows some action based on the change. Maybe I am using it wrong.
Here is what I want to do and maybe you can suggest a different approach.
I have say three pages '1', '2' and '3' using the keyboard numbers to switch pages. When I am on page '3' then press '1' to bring up page '1' I would like page '3' get a callback to shutdown or release resources.
Any suggestions?
@Bios-Marcel commented on GitHub (Oct 17, 2019):
Could still access the Pages struct from within the callback. That's what I'd at least.
@rivo commented on GitHub (Oct 18, 2019):
Multiple pages can be visible at the same time so there is not really one page that I could supply to that "changed" callback. But you are right in that
Pagesdoesn't provide many functions to inspect its current state. To make your example easier, I added a functionGetFrontPage()which should solve your problem. Let me know if this helps.