[GH-ISSUE #1012] Button border disappeared when clicked #735

Closed
opened 2026-03-04 01:07:22 +03:00 by kerem · 1 comment
Owner

Originally created by @duguanyue on GitHub (Jul 26, 2024).
Original GitHub issue: https://github.com/rivo/tview/issues/1012

I tried to make a simple UI, and found that when the button was clicked, its border disappeared, and when it lost focus, its border appeared again, I don't know why. please help to check.

package main

import (
	"github.com/gdamore/tcell/v2"
	"github.com/rivo/tview"
)

func main() {
	app := tview.NewApplication()
	input := tview.NewInputField().
		SetPlaceholder("Input a number...").
		SetPlaceholderStyle(tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorGray)).
		SetFieldBackgroundColor(tcell.ColorBlack)
	input.SetBorder(true)

	button := tview.NewButton("QUERY").
		SetStyle(tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorGreenYellow)).
		SetActivatedStyle(tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorGreenYellow))
	button.SetBorder(true)

	display := tview.NewTextView()
	display.SetBorder(true).SetTitle("DISPLAY")

	extra := tview.NewBox().SetBorder(true).SetTitle("EXTRA")

	grid := tview.NewGrid().
		SetRows(3, 0).
		SetColumns(100, 0).
		AddItem(input, 0, 0, 1, 1, 0, 100, true).
		AddItem(button, 0, 1, 1, 1, 0, 0, false).
		AddItem(display, 1, 0, 1, 1, 0, 100, false).
		AddItem(extra, 1, 1, 1, 1, 0, 100, false)

	if err := app.SetRoot(grid, true).EnableMouse(true).Run(); err != nil {
		panic(err)
	}
}
image
Originally created by @duguanyue on GitHub (Jul 26, 2024). Original GitHub issue: https://github.com/rivo/tview/issues/1012 I tried to make a simple UI, and found that when the button was clicked, its border disappeared, and when it lost focus, its border appeared again, I don't know why. please help to check. ``` package main import ( "github.com/gdamore/tcell/v2" "github.com/rivo/tview" ) func main() { app := tview.NewApplication() input := tview.NewInputField(). SetPlaceholder("Input a number..."). SetPlaceholderStyle(tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorGray)). SetFieldBackgroundColor(tcell.ColorBlack) input.SetBorder(true) button := tview.NewButton("QUERY"). SetStyle(tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorGreenYellow)). SetActivatedStyle(tcell.StyleDefault.Background(tcell.ColorBlack).Foreground(tcell.ColorGreenYellow)) button.SetBorder(true) display := tview.NewTextView() display.SetBorder(true).SetTitle("DISPLAY") extra := tview.NewBox().SetBorder(true).SetTitle("EXTRA") grid := tview.NewGrid(). SetRows(3, 0). SetColumns(100, 0). AddItem(input, 0, 0, 1, 1, 0, 100, true). AddItem(button, 0, 1, 1, 1, 0, 0, false). AddItem(display, 1, 0, 1, 1, 0, 100, false). AddItem(extra, 1, 1, 1, 1, 0, 100, false) if err := app.SetRoot(grid, true).EnableMouse(true).Run(); err != nil { panic(err) } } ``` <img width="461" alt="image" src="https://github.com/user-attachments/assets/b49670e1-270c-4912-a3ba-d592a3b1d18f">
kerem closed this issue 2026-03-04 01:07:22 +03:00
Author
Owner

@rivo commented on GitHub (Jul 28, 2024):

This appears to have been a bug from some ill-conceived idea I had in the very beginning of this project. The latest commit should fix this.

<!-- gh-comment-id:2254490927 --> @rivo commented on GitHub (Jul 28, 2024): This appears to have been a bug from some ill-conceived idea I had in the very beginning of this project. The latest commit should fix this.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#735
No description provided.