From e1bdf36d098df698ac5cff08debfef9c0f539d89 Mon Sep 17 00:00:00 2001 From: xengineering Date: Tue, 11 Apr 2023 21:44:11 +0200 Subject: Implement dummy functionality for first view --- go/main.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/go/main.go b/go/main.go index f646d7d..d055aa8 100644 --- a/go/main.go +++ b/go/main.go @@ -20,6 +20,7 @@ type Limox struct { JidEditor widget.Editor PwdEditor widget.Editor ConnectClickable widget.Clickable + Connecting bool Window *app.Window Operations op.Ops Theme *material.Theme @@ -47,6 +48,7 @@ func NewLimox() Limox { ), Operations: op.Ops{}, Theme: material.NewTheme(gofont.Collection()), + Connecting: false, } } @@ -57,6 +59,15 @@ func (l *Limox) run() error { case system.DestroyEvent: return e.Err case system.FrameEvent: + if l.ConnectClickable.Clicked() { + l.Connecting = !l.Connecting + if l.Connecting { + log.Printf("User wants to connect with '%s' and '%s'.\n", + l.JidEditor.Text(), + l.PwdEditor.Text(), + ) + } + } l.draw(e) } } @@ -94,7 +105,13 @@ func (l *Limox) draw(e system.FrameEvent) { ), layout.Rigid( func(gtx layout.Context) layout.Dimensions { - btn := material.Button(l.Theme, &l.ConnectClickable, "connect") + var label string + if l.Connecting { + label = "abort" + } else { + label = "connect" + } + btn := material.Button(l.Theme, &l.ConnectClickable, label) return btn.Layout(gtx) }, ), -- cgit v1.2.3-70-g09d2