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

color picker callback isn't called in case of dismissal #5237

Open
2 tasks done
ole108 opened this issue Nov 4, 2024 · 3 comments
Open
2 tasks done

color picker callback isn't called in case of dismissal #5237

ole108 opened this issue Nov 4, 2024 · 3 comments
Labels
unverified A bug that has been reported but not verified

Comments

@ole108
Copy link

ole108 commented Nov 4, 2024

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

The callback provides when creating a new color picker is called when a color is chosen - great.
For the file dialogs the same callback is called with a nil value for dismissal - great.
This does not happen in the case of the color picker.

How to reproduce

  1. Create a color picker with a callback function.
  2. Show the color picker.
  3. Hit the cancel button.
  4. The callback function isn't called.

Screenshots

No response

Example code

package main

import (
	"fmt"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/dialog"
	"image/color"
)

func main() {
	fapp := app.NewWithID("app-with-unique-id")
	win := fapp.NewWindow("pick color")

	cp := dialog.NewColorPicker("", "", func(c color.Color) {
		fmt.Println("Color callback called with:", c)
		win.Close()
		fapp.Quit()
	}, win)

	cp.Show()
	win.Show()
	fapp.Run()
}

Fyne version

2.5.2

Go compiler version

1.23.2

Operating system and version

Linux 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 GNU/Linux

Additional Information

I will be happy to fix this bug.
I have to find out how this is done at Fyne first.

@ole108 ole108 added the unverified A bug that has been reported but not verified label Nov 4, 2024
@ole108
Copy link
Author

ole108 commented Nov 5, 2024

I have created a pull request:
#5241

But the checks aren't running automatically?

@andydotxyz
Copy link
Member

They would be normally, but GitHub no longer trusts first time contributors

@andydotxyz
Copy link
Member

This bug report doesn't seem to match what we discussed on Discord.
I thought you were reporting that OnClosed is called before the callback so you cannot tell if the item was picked when the dialog goes away if you register both?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

2 participants