Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Move in a List does not work when using ScrollArea #133

Open
Lallassu opened this issue Jun 3, 2018 · 2 comments
Open

Move in a List does not work when using ScrollArea #133

Lallassu opened this issue Jun 3, 2018 · 2 comments
Labels

Comments

@Lallassu
Copy link

Lallassu commented Jun 3, 2018

When I add a ScrollArea to a VBox which contains a List and then add the list to the FocusChain I cannot move in the list with arrow-keys. It works fine as long as I don't have a ScrollArea around it. Am I missing something or is this a bug?

l := tui.NewList()
l.AddItems("line1", "line2", "line3", "line4")
l.SetSelected(0)
userScroll := tui.NewScrollArea(l)
userScroll.SetSizePolicy(tui.Preferred, tui.Maximum)
sidebar1 := tui.NewVBox(userScroll)
sidebar1.SetBorder(true)
sidebar1.SetTitle("List1")
sidebar.Prepend(sidebar1)
....
focusChain.Set(l, l2) // l2 is a list without a ScrollArea

Note that I have a "main" sidebar which holds 2 other sidebars (VBoxes) that contain a list each. One of them have a ScrollArea. And that one will not scroll when selected.

@marcusolsson
Copy link
Owner

Looks like the key event is not being forwarded to the underlying widget.

ScrollArea should reimplement OnKeyEvent(ev KeyEvent) and pass on the event to the widget it encapsulates. Here's it's done for Box: https://github.com/marcusolsson/tui-go/blob/master/box.go#L213

@marcusolsson
Copy link
Owner

I'd be happy to accept a PR, otherwise I should be able to add a fix for this during the week.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants