-
-
Notifications
You must be signed in to change notification settings - Fork 126
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
[bug] SplitLayout causes the text input to lose focus on adding/removing rows to a table widget #717
Comments
@WinPooh32 try to set ID of your input text manually |
g.InputText(&filter).Hint("Filter...").Label("##custom_id") Changes nothing. |
@WinPooh32 use ID(...) instead of Label(...) |
There is no ID method at the InputText. My code: if len(rows) == 0 {
return g.Table().Rows(g.TableRow(g.Dummy(0, 0))).ID("table1234")
}
return g.Table()..Rows(rows...).ID("table1234") |
But when rows are filled by buttons, focus is lost on every table change. IDs do not help:
|
because your ID is the same for all rows and buttons, make them unique by add index into ID. |
I have set ID only for buttons (rows have not method g.Button("").ID(fmt.Sprintf("%d", i)), full example:
|
well strange... SO its not problem of ID |
my research:
|
A minimalistic reproduction code: package main
import (
g "github.com/AllenDang/giu"
)
var (
filter string
sashPos float32 = 100
)
func buildTable() g.Widget {
if filter != "" {
return g.Layout{}
}
return g.Button("btn")
}
func loop() {
g.SingleWindow().Layout(
g.SplitLayout(
g.DirectionHorizontal,
&sashPos,
g.Layout{},
g.Layout{
g.InputText(&filter).Hint("Filter..."),
// If I put it here, it works?
// giu.Custom(func() {
// buildTable().Build()
// })
buildTable(),
},
),
)
}
func main() {
wnd := g.NewMasterWindow("Huge list demo", 800, 600, 0)
wnd.Run(loop)
} also @WinPooh32 if you put your table builder in giu.Custom it starts to work (no idea why...) |
haha I've just lookad at this code and got the answer - I'll write it here after a qucik play with dlv |
ok, nevermind, I have no idea why it doesn't wokr... |
Hello, I am also experiencing this issue, but in a slight variation.
The problem also goes away when using Custom(). |
What happend?
I'm trying to filter table rows by a user-typed text. The text input widget loses focus when table rows are changed. It happens only when the table is a sub-widget of the SplitLayout. (
v0.7.0
)At the
master
version it loses focus only when table is removed from the layout (table without rows causes panic on any version).Code example
main.go
To Reproduce
qwerty
to the text input form.Version
(latest)
OS
Ubuntu 20.04.6
The text was updated successfully, but these errors were encountered: