Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec.Command and widget.Button combination not working #1857

Closed
ekanna opened this issue Jan 24, 2021 · 3 comments
Closed

exec.Command and widget.Button combination not working #1857

ekanna opened this issue Jan 24, 2021 · 3 comments
Labels
blocker Items that would block a forthcoming release bug Something isn't working OS:macOS Tickets affecting only macOS

Comments

@ekanna
Copy link

ekanna commented Jan 24, 2021

exec.Command making entire window as a button:

I have few files in one folder. I want to open that folder when a user clicks on widget.Button using native FileOpenDialog. First click is working fine but after second click, wherever i click on window, it is only opening folder!

To Reproduce:

Steps to reproduce the behaviour:

  1. Click on hello button it will open native fileOpenDialog
  2. Close that DialogBox
  3. Now click anywhere on the window it will open only FileOpenDialog

Video:

https://slack-files.com/T029RQSE6-F01L1LDM857-4ba662ff80

Example code:

package main

import (
	"os/exec"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/widget"
)

func exploreDirectory() {
	cmd := exec.Command("open", ".") // open current directory
	cmd.Start()
}

func main() {
	a := app.New()
	w := a.NewWindow("foo")

	b := widget.NewButton("Open", func() {
		//fmt.Println("Hai")
		exploreDirectory()
	})
	title1 := widget.NewLabel("Hello")
	title2 := widget.NewLabel("World")
	k := container.NewVBox(title1, b, title2)
	w.SetContent(k)
	w.Resize(fyne.NewSize(200, 200))
	w.ShowAndRun()
}

Device (please complete the following information):

  • OS: MacOS
  • Version: 10.14.3
  • Go version: 1.15.2
  • Fyne version: 1.14 and 2.0
@ekanna ekanna added the bug Something isn't working label Jan 24, 2021
@nick-remeeting
Copy link

+1. I've seen this bug in the context of a button opening a webpage. It seems like if (any?) new window is opened by a button click, clicking back into the Fyne window will trigger that button click again.

The only way to get focus back on the Fyne window appears to be to click the title bar of the window.

@andydotxyz
Copy link
Member

Hmm, I see this too now.
This is not for any new window, it is for any new window in a different application.
So it seems like we are not resetting the button/mouse states correctly when the app loses focus.

@andydotxyz
Copy link
Member

This is now ready for testing on release/v2.0.x branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Items that would block a forthcoming release bug Something isn't working OS:macOS Tickets affecting only macOS
Projects
None yet
Development

No branches or pull requests

3 participants