Skip to content

not active window is black on first show #5649

Open
@yangjuncode

Description

@yangjuncode

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

not active window has black color in first show

How to reproduce

build and run example code

Screenshots

Image

Example code

package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
)

var data = []string{"a", "string", "list"}

func main() {
	myApp := app.New()
	myWindow := myApp.NewWindow("List Widget")

	list := widget.NewList(
		func() int {
			return len(data)
		},
		func() fyne.CanvasObject {
			return widget.NewLabel("template")
		},
		func(i widget.ListItemID, o fyne.CanvasObject) {
			o.(*widget.Label).SetText(data[i])
		})

	myWindow.Resize(fyne.NewSize(300, 600))
	myWindow.SetContent(list)

	var table_data = [][]string{[]string{"top left", "top right"},
		[]string{"bottom left", "bottom right"}}

	table := widget.NewTable(
		func() (int, int) {
			return len(table_data), len(table_data[0])
		},
		func() fyne.CanvasObject {
			return widget.NewLabel("template")
		},
		func(i widget.TableCellID, o fyne.CanvasObject) {
			o.(*widget.Label).SetText(table_data[i.Row][i.Col])
		})

	tableWindow := myApp.NewWindow("Table Widget")
	tableWindow.Resize(fyne.NewSize(300, 600))
	tableWindow.SetContent(table)
	tableWindow.Show()

	treeWindow := myApp.NewWindow("tree Widget")

	tree := widget.NewTree(
		func(id widget.TreeNodeID) []widget.TreeNodeID {
			switch id {
			case "":
				return []widget.TreeNodeID{"a", "b", "c"}
			case "a":
				return []widget.TreeNodeID{"a1", "a2"}
			}
			return []string{}
		},
		func(id widget.TreeNodeID) bool {
			return id == "" || id == "a"
		},
		func(branch bool) fyne.CanvasObject {
			if branch {
				return widget.NewLabel("Branch template")
			}
			return widget.NewLabel("Leaf template")
		},
		func(id widget.TreeNodeID, branch bool, o fyne.CanvasObject) {
			text := id
			if branch {
				text += " (branch)"
			}
			o.(*widget.Label).SetText(text)
		})

	treeWindow.SetContent(tree)
	treeWindow.Resize(fyne.NewSize(300, 600))
	treeWindow.Show()

	myWindow.ShowAndRun()
}

Fyne version

2.6.0-rc2

Go compiler version

1.24.1

Operating system and version

manjaro kde

Additional Information

Operating System: Manjaro Linux
KDE Plasma Version: 6.3.3
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.2
Kernel Version: 6.12.20-2-MANJARO (64-bit)
Graphics Platform: X11
Processors: 12 × 13th Gen Intel® Core™ i7-1355U
Memory: 31.0 GiB of RAM
Graphics Processor: Intel® Iris® Xe Graphics
Manufacturer: Dell Inc.
Product Name: Latitude 5540

Metadata

Metadata

Assignees

No one assigned

    Labels

    unverifiedA bug that has been reported but not verified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions