Skip to content

Commit

Permalink
examples/widgets: do not use depracted api for TreeNode events
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Nov 27, 2024
1 parent 7835e3c commit 5a42291
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/widgets/widgets.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"image/color"
"time"

"github.com/AllenDang/giu"

Check failure on line 9 in examples/widgets/widgets.go

View workflow job for this annotation

GitHub Actions / Lint

dupImport: package is imported 2 times under different aliases on lines 9 and 10 (gocritic)
g "github.com/AllenDang/giu"

Check failure on line 10 in examples/widgets/widgets.go

View workflow job for this annotation

GitHub Actions / Lint

dupImport: package is imported 2 times under different aliases on lines 9 and 10 (gocritic)
)

Expand Down Expand Up @@ -179,11 +180,13 @@ func loop() {
g.TreeNode("TreeNode with event handler").Layout(
g.Selectable("Selectable 1").OnClick(func() { fmt.Println(1) }),
g.Selectable("Selectable 2").OnClick(func() { fmt.Println(2) }),
).Event(func() {
if g.IsItemClicked(g.MouseButtonLeft) {
fmt.Println("Clicked")
}
}),
).EventHandler(giu.Event().OnClick(giu.MouseButtonLeft, func() {
fmt.Println("Clicked")
}).OnDClick(giu.MouseButtonLeft, func() {
fmt.Println("Double-Clicked")
}).OnClick(giu.MouseButtonRight, func() {
fmt.Println("Right-Clicked")
})),
),
g.TabItem("TreeTable").Layout(
g.TreeTable().
Expand Down

0 comments on commit 5a42291

Please sign in to comment.