fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.25k stars 1.4k forks source link

Check Box not moving with window resize #5183

Closed rahairston closed 1 month ago

rahairston commented 1 month ago

Checklist

Describe the bug

When creating a window, then resizing the window any Horizontal layout with a centered selectable item will not have the selection area centered.

In short, the "select" area for a check box is at the top of the Box even when the actual select circle is in the center vertically

How to reproduce

  1. Create App
  2. Create Window
  3. Resize Window
  4. Create checkbox
  5. Put checkbox inside Horizontal Layout Item
  6. Set the content
  7. Show and run the window

Screenshots

No response

Example code

    myApp := app.New()
    myWindow := myApp.NewWindow("Choice Widgets")

    myWindow.Resize(fyne.NewSize(500, 500))

    check := widget.NewCheck("Optional", func(value bool) {
        log.Println("Check set to", value)
    })

    myWindow.SetContent(container.NewHBox(check))
    myWindow.ShowAndRun()

Fyne version

v2.5.1

Go compiler version

go1.23.1

Operating system and version

Windows 10 Version 10.0.19045 Build 19045

Additional Information

No response

andydotxyz commented 1 month ago

The container.NewHBox is not centered - it is a horizontal pack to the leading edge. Use container.NewCenter to get the central positioning for the child items.

The layout list is at https://docs.fyne.io/explore/layouts

andydotxyz commented 1 month ago

Closed as there is no issue here