-
Notifications
You must be signed in to change notification settings - Fork 648
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
combobox doesn't render on windows? #380
Comments
It is a known issue but I can't figure out on what configurations it happens... keep this open until further notice. |
This reproduces consistently for me: Go 1.16, Windows 10 x64: https://gist.github.com/fbd4d52084621c49b5bf0b569b9195b4 package main
import (
"fmt"
"github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest"
)
func makePage1() ui.Control {
return ui.NewLabel("Page 1")
}
func makePage2() ui.Control {
vb := ui.NewVerticalBox()
vb.SetPadded(true)
vb.Append(ui.NewLabel("Choose"), false)
strings := make([]string, 300)
for i := 0; i < len(strings); i++ {
strings[i] = fmt.Sprintf("This is a string to choose %d", i)
}
cbox := ui.NewCombobox()
for _, entry := range strings {
cbox.Append(entry)
}
vb.Append(cbox, false)
return vb
}
func setupUI() {
win := ui.NewWindow("Test", 800, 600, true)
win.OnClosing(func(*ui.Window) bool {
ui.Quit()
return true
})
ui.OnShouldQuit(func() bool {
win.Destroy()
return true
})
tabCtrl := ui.NewTab()
win.SetChild(tabCtrl)
win.SetMargined(true)
tabCtrl.Append("Tab 1", makePage1())
tabCtrl.SetMargined(0, true)
tabCtrl.Append("Tab 2", makePage2())
tabCtrl.SetMargined(1, true)
win.Show()
}
func main() {
ui.Main(setupUI)
} When you switch to Page 2, the combobox appears invisible until you mouse over it. |
After switching & mousing over, it remains rendered if you switch away & back or to a 3rd tab. |
Thinking it might be related, but there doesn't appear to be a way to prime a ComboBox with a selection: cbox := ui.NewComboBox()
addEntries(cbox)
cbox.OnSelected(func(_ *ui.Combobox) { panic("on selected") })
parent.Append(cbox, false)
cbox.SetSelected(0)
win.Show() edit: my bad, cbox.SetSelected never calls OnSelected. |
Is it a known issue that combobox only render itself after mouse hoover over? This only happens in windows build, is there way to force to redraw the UI? Thanks!
The text was updated successfully, but these errors were encountered: