mirror of
https://github.com/rivo/tview.git
synced 2026-04-26 21:35:54 +03:00
[GH-ISSUE #385] Make items in Flex public #283
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#283
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 @esell on GitHub (Jan 13, 2020).
Original GitHub issue: https://github.com/rivo/tview/issues/385
Does it make sense to expose the
itemsvariable in the Flex primitive (https://github.com/rivo/tview/blob/master/flex.go#L31) ?The reason I am asking is I have a simple 4 column layout where I would like to cycle through each column when a certain key is pressed. Right now I've setup a
SetInputCapture()to listen for the key press and thenSetFocus()on the next item, effectively moving the focus from column to column. The problem with this method is that I need to hard code the primitive that should get focus next. It would be awesome to be able to just use something likeflex.Items[n+1]or something similar. Since the data is already there in theitemsvariable, it seems like a great data source for something like this.@tslocum commented on GitHub (Jan 16, 2020):
Hey @esell, does a
Flex.GetItemmethod which returns the primitive at that index solve your use case? I will submit a PR adding it if so.@esell commented on GitHub (Jan 16, 2020):
Good timing @tslocum :). I actually just swapped out for your cview and used the Flex.GetChildren (https://godoc.org/git.sr.ht/~tslocum/cview#Flex.GetChildren) function, it was exactly what I was looking for.
Before that I was just keeping track of everything in a slice I created.