Skip to content

Mouse Wheel Scrolling not Working for TreeView When Application Has Mouse Enabled #796

@SolarLune

Description

@SolarLune

Hello - firstly, really love tview and this framework - it's fantastic! Thanks a ton for creating it and continually working on it! It's driving TetraTerm, my remote scene visualization tool for games made with my 3D renderer Tetra3D. Really loving how flexibly it displays while working from a terminal.

The issue I'm having is that when an Application has mouse support enabled via Application.EnableMouse(true), TreeViews can no longer scroll using the mouse wheel. Here's a reproduction program adapted from the example in the wiki for TreeViews:

package main

import (
	"github.com/rivo/tview"
)

func main() {

	root := tview.NewTreeNode("Root")

        // Create enough nodes to need to scroll
	for i := 0; i < 20; i++ {
		root.AddChild(tview.NewTreeNode("Node"))
	}

	tree := tview.NewTreeView().SetRoot(root).SetCurrentNode(root)

	app := tview.NewApplication().SetRoot(tree, true)

	// Uncomment the line below and scrolling with the wheel stops working
	// app.EnableMouse(true)

	if err := app.Run(); err != nil {
		panic(err)
	}

}

This example works fine, but if you uncomment the app.EnableMouse(true) line above, the mouse wheel no longer scrolls the tree view.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions