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

Unrelated Button Disable Causes Entry ActionItem to Not Be Displayed #4993

Open
2 tasks done
p4k1tz opened this issue Jul 6, 2024 · 4 comments
Open
2 tasks done

Unrelated Button Disable Causes Entry ActionItem to Not Be Displayed #4993

p4k1tz opened this issue Jul 6, 2024 · 4 comments
Labels
information-needed Further information is requested unverified A bug that has been reported but not verified

Comments

@p4k1tz
Copy link

p4k1tz commented Jul 6, 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

When creating an entry with an ActionItem, if a formerly defined button is disabled the ActionItem is not displayed.

How to reproduce

Not sure if it is specific to the dialog, layout, etc. But if you create a button, disable it explicitly, and then create an entry with an ActionItem, and then add these items as the content to a dialog, you will find the ActionItem is not displayed.

Screenshots

No response

Example code

	folderToWatchBinding := binding.NewString()
	entryFolderToWatch := widget.NewEntryWithData(folderToWatchBinding)

	continueButton := widget.NewButton(
		"Start",
		func() {
			go func() {
				folder, err := folderToWatchBinding.Get()
				if err != nil {
					dialog.ShowError(errors.New("unable to open folder"), m.Window)
				} else {
					log.Println(folder)
				}
			}()

		},
	)

	continueButton.Disable()

	folderToWatchOpenFolderButton := widget.NewButtonWithIcon(
		"",
		theme.FolderOpenIcon(),
		func() {
			folder, err := zenity.SelectFile(zenity.Directory())

			if err != nil {
				if err != zenity.ErrCanceled {
					dialog.ShowError(
						errors.New(fmt.Sprintf("Unable to open folder: %s", err)),
						m.Window,
					)
				}
			} else {
				if err = folderToWatchBinding.Set(folder); err != nil {
					dialog.ShowError(
						errors.New(fmt.Sprintf("Unable to open folder: %s", err)),
						m.Window,
					)
				} else {
					continueButton.Enable()
				}
			}
		},
	)

	//folderToWatchOpenFolderButton.MinSize()
	folderToWatchOpenFolderButton.Enable()

	entryFolderToWatch.ActionItem = folderToWatchOpenFolderButton
	entryFolderToWatch.Validator = nil

	folderToWatchLabel := widget.NewLabel("Folder To Watch:")
	folderToWatchLabel.TextStyle = fyne.TextStyle{Bold: true}

	form := &widget.Form{
		Items: []*widget.FormItem{
			{Text: "Max Threads:", Widget: entryFolderToWatch},
		},
		OnSubmit: func() {},
	}

	customDialog := dialog.NewCustomWithoutButtons(
		"Image to PAA Watcher",
		form,
		m.Window,
	)

	cancelButton := widget.NewButton(
		"Cancel",
		func() {
			customDialog.Hide()
		},
	)

	cancelButton.Importance = widget.HighImportance

	customDialog.SetButtons([]fyne.CanvasObject{continueButton, cancelButton})

	customDialog.Resize(
		fyne.NewSize(
			//m.Window.Content().Size().Width*0.5,
			//m.Window.Content().Size().Height*0.5,
			m.Window.Content().Size().Width,
			m.Window.Content().Size().Height,
		),
	)

	customDialog.Show()
	```

### Fyne version

v2.4.6-0.20240705195151-7d4b6e61804e

### Go compiler version

1.21.0

### Operating system and version

Windows 10

### Additional Information

_No response_
@p4k1tz p4k1tz added the unverified A bug that has been reported but not verified label Jul 6, 2024
@p4k1tz
Copy link
Author

p4k1tz commented Jul 6, 2024

Happens when any button call to Disable() comes before setting the ActionItem.

@andydotxyz
Copy link
Member

The "go func" above is complete unneeded.

@andydotxyz
Copy link
Member

andydotxyz commented Jul 6, 2024

I cannot see what is impacting above, if the issue relates to a button and an entry can you replicate it with just them? I cannot think of any way that one widget can impact another.

Please set up minimal code sample when reporting an issue.

@dweymouth dweymouth added the information-needed Further information is requested label Jul 9, 2024
@p4k1tz
Copy link
Author

p4k1tz commented Jul 9, 2024

I cannot see what is impacting above, if the issue relates to a button and an entry can you replicate it with just them? I cannot think of any way that one widget can impact another.

Please set up minimal code sample when reporting an issue.

Yea, give me a few days so I can float this on my backlog.

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

No branches or pull requests

3 participants