Skip to content

Commit

Permalink
Add scroll area
Browse files Browse the repository at this point in the history
  • Loading branch information
fenimore committed Sep 16, 2017
1 parent 8a114a8 commit 8d4b741
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions alio.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ func main() {
sLabel := tui.NewLabel("Songs")
aLabel.SetStyleName("album")
sLabel.SetStyleName("album")
wrap := tui.NewScrollArea(libTable)
library := tui.NewVBox(
aLabel,
libTable,
wrap,
tui.NewSpacer(),
)
library.SetBorder(false)
Expand Down Expand Up @@ -174,6 +175,9 @@ func main() {

ui = tui.New(root)

ui.SetKeybinding("Up", func() { wrap.Scroll(0, -1) })
ui.SetKeybinding("Down", func() { wrap.Scroll(0, 1) })

// move the cursor to the first album
libTable.Select(1)

Expand Down Expand Up @@ -319,16 +323,21 @@ func main() {
if !*NOTHEME {
ui.SetTheme(theme)
}
log.Println(libTable.MinSizeHint())
log.Println(libTable.Selected())
log.Println(libTable.Size())
log.Println(libTable.SizeHint())

if err := ui.Run(); err != nil {
panic("Run " + err.Error())
}
fmt.Println(help)
//fmt.Println(help)
fmt.Println("Adios from Alio Music Player!")
}

// in its own goroutine...
func playAlbum(p *vlc.Player, a Album, l *tui.List, t *tui.Table, s *tui.StatusBar, done, next, prev chan struct{}) (err error) {
log.Printf("PlayAlbum \n")
log.Printf("PlayAlbum %s \n", a.Title)
pg.Wait()
pg.Add(1)
defer pg.Done()
Expand Down Expand Up @@ -459,6 +468,7 @@ func CollectAlbums(root string) ([]*Album, error) {
}
}

log.Printf("Album Lenght %d", len(albums))
return albums, nil
}

Expand Down

0 comments on commit 8d4b741

Please sign in to comment.