Skip to content

How to reset internal "state" for inputtextmultiline and maybe other widgets? #886

Closed Answered by gucio321
deoxyimran asked this question in Q&A
Discussion options

You must be logged in to vote

Try this:

package main

import (
    "github.com/AllenDang/giu"
)

var (
    currentIdx string = "id1"
    data              = map[string]*string{
        "id1": new(string),
        "id2": new(string),
        "id3": new(string),
    }
)

func loop() {
    giu.SingleWindow().Layout(
        giu.InputTextMultiline(data[currentIdx]),
        giu.RangeBuilder("switcher", []string{"id1", "id2", "id3"}, func(_ int, s string) giu.Widget {
            return giu.Button(s).OnClick(func() { currentIdx = s })
        }),
    )
}

func main() {
    wnd := giu.NewMasterWindow("Clean Input Text Multiline [discussion #866]", 640, 480, 0)
    wnd.Run(loop)
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gucio321
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants