You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to display a long [up to 5000+rows] and complicated [more than 10+ columns] table, and jump to a target row. But the table content is not fixed, it is computed by some condition. And after it was computed and displayed, it should jump to that target row.
It does work for existed and simple table. But if I increased rows up to 5000 and create table content dynamically, it won't jump to that row. And if you move mouse, it will jump after mouse moving. I think this may because I haven't ask giu Update correctly, but it won't work with g.Update() called.
Code example
main.go
// put your code here!package main
import (
g "github.com/AllenDang/giu""github.com/AllenDang/imgui-go"
)
var (
scrollTriggerboolscrollIndexintlines []*g.TableRowWidget
)
funcloop() {
g.SingleWindow().Layout(
g.Button("Scroll to row 448").OnClick(func() {
createLines(5000)
scrollTrigger=truescrollIndex=448// g.Update() // add this line doesn't work as wanted
}),
g.Table().Columns(g.TableColumn("Col1"), g.TableColumn("a"), g.TableColumn("b"), g.TableColumn("c"), g.TableColumn("d"), g.TableColumn("e"), g.TableColumn("f"), g.TableColumn("g"), g.TableColumn("h"), g.TableColumn("i")).Rows(lines...),
)
}
funcmain() {
wnd:=g.NewMasterWindow("Hello world", 600, 200, 0)
wnd.Run(loop)
}
funccreateLines(totalint) {
fori:=0; i<total; i++ {
index:=ilines=append(lines, g.TableRow(g.Custom(func() {
g.Labelf("Label %d", index).Build()
ifscrollTrigger {
ifscrollIndex==index {
imgui.SetScrollHereY(0.5)
scrollTrigger=false
}
}
}), g.Label("aa"), g.Label("bb"), g.Label("cc"), g.Label("d"), g.Label("e"), g.Label("f"), g.Label("g"), g.Label("h"), g.Label("i")))
}
}
To Reproduce
Run my demo
You may see it haven't jump to the target. If your pc is very well, maybe you should increase rows to 10000.
Version
master
OS
macOS Monterey 12.6.5
The text was updated successfully, but these errors were encountered:
What happend?
I want to display a long [up to 5000+rows] and complicated [more than 10+ columns] table, and jump to a target row. But the table content is not fixed, it is computed by some condition. And after it was computed and displayed, it should jump to that target row.
I have tried the code from here: #397 (comment)
It does work for existed and simple table. But if I increased rows up to 5000 and create table content dynamically, it won't jump to that row. And if you move mouse, it will jump after mouse moving. I think this may because I haven't ask giu Update correctly, but it won't work with g.Update() called.
Code example
main.go
To Reproduce
Version
master
OS
macOS Monterey 12.6.5
The text was updated successfully, but these errors were encountered: