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

Calling popUp.Hide() closes all overlays, not just the popup itself. Feature or bug? #4771

Open
2 tasks done
Agustincou opened this issue Apr 7, 2024 · 1 comment
Open
2 tasks done
Labels
unverified A bug that has been reported but not verified

Comments

@Agustincou
Copy link

Agustincou commented Apr 7, 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

Hi!,

I don't know if this is a feature or bug.

Is it correct that calling popUp.Hide() closes all overlays that occur after popUp.Show()?

In my actual use case, in a function on entry I do a popUp.Show() and then do a "defer popUp.Hide()" so that it is executed at the end of the function.
The problem is that any dialog that I show during the execution of the function, does not end up showing because defer popUp.Hide() hides all the dialogs.

How to reproduce

  1. Run the example code.
  2. Click the "Show PopUp" button
  3. Notice that only the first dialog box before popUp.Show() is displayed.

Screenshots

No response

Example code

package main

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

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

	popToShow := widget.NewPopUp(widget.NewLabel("PopUp Label"), w.Canvas())
	prePopUpDialogToShow := dialog.NewCustom("Pre popUp Custom Dialog", "Dismiss", widget.NewLabel("Test Content"), w)
	postPopUpDialogToShow := dialog.NewCustom("Post popUp Custom Dialog", "Dismiss", widget.NewLabel("Test Content"), w)
	postPopUpDialogToShow2 := dialog.NewCustom("Post popUp Custom Dialog 2", "Dismiss", widget.NewLabel("Test Content"), w)

	w.Resize(fyne.NewSize(300, 300))
	w.SetContent(
		widget.NewButton(
			"Show PopUp",
			func() {
				prePopUpDialogToShow.Show()
				popToShow.ShowAtRelativePosition(fyne.NewPos(0, 0), w.Content())
				postPopUpDialogToShow.Show()
				postPopUpDialogToShow2.Show()
				popToShow.Hide() // <- This not only hides the popup, but also hides all overlays after the popup is shown.
			},
		),
	)
	w.ShowAndRun()
}

Fyne version

2.4.3

Go compiler version

1.22.2

Operating system and version

Linux Mint 21.2

Additional Information

No response

@Agustincou Agustincou added the unverified A bug that has been reported but not verified label Apr 7, 2024
@andydotxyz
Copy link
Member

Overlays are stacked, so closing one below will close all those added on top of it.

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