Add giowrap.Clickable().
This commit is contained in:
+7
-7
@@ -25,23 +25,23 @@ func main() {
|
||||
ctx := giowrap.NewContext(w)
|
||||
t := time.NewTicker(time.Second/30)
|
||||
e1 := giowrap.NewEditor(ctx.Faces.For(regular, ui.Sp(24)), true)
|
||||
e1.SetText("hi there")
|
||||
e1.SetText("text 1")
|
||||
e1.Focus()
|
||||
|
||||
e2 := giowrap.NewEditor(ctx.Faces.For(regular, ui.Sp(24)), true)
|
||||
e2.SetText("ok bye")
|
||||
e2.SetText("text 2")
|
||||
|
||||
f := giowrap.NewFlex(layout.Vertical, layout.Start, layout.Start)
|
||||
OuterInset := giowrap.NewInset(ui.Dp(10),ui.Dp(10),ui.Dp(10),ui.Dp(10))
|
||||
InnerInset := giowrap.NewInset(ui.Dp(10),ui.Dp(10),ui.Dp(10),ui.Dp(10))
|
||||
|
||||
lbl := giowrap.NewButton(
|
||||
lbl := giowrap.NewLabel(
|
||||
ctx.Faces.For(regular, ui.Sp(24)),
|
||||
"centered",
|
||||
"push",
|
||||
text.Center,
|
||||
)
|
||||
bg := giowrap.NewBackground(giowrap.Rgb(0x3c98c6), ui.Dp(4))
|
||||
btn := bg(lbl)
|
||||
btn := giowrap.Clickable(bg(lbl))
|
||||
|
||||
for {
|
||||
select {
|
||||
@@ -52,7 +52,7 @@ func main() {
|
||||
case app.DestroyEvent:
|
||||
return
|
||||
case app.DrawEvent:
|
||||
ctx.Reset(e)
|
||||
ctx = ctx.Reset(e)
|
||||
ctx = giowrap.LayoutWithContext(ctx,
|
||||
OuterInset(
|
||||
f(
|
||||
@@ -63,7 +63,7 @@ func main() {
|
||||
btn,
|
||||
)))
|
||||
ctx.Draw()
|
||||
if lbl.Clicked(ctx) {
|
||||
if btn.Clicked(ctx) {
|
||||
log.Print("Clicked: " + e2.Text() )
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user