[howTo] Respond to enter key in an input box
What happend?
Hey,
thanks a lot for your great work.
I am currently trying to respond to the "Enter" key in an input box. However, the combination of if g.IsKeyPressed(g.KeyEnter) && g.IsItemActive() does not work.
Enter makes the focus disappear from the item (which is ok) but at that moment the IF condition no longer applies. If I omit isItemActive all enter keys are taken into account, which I don't want.
Code example
main.go
g.InputText(&doc_tags_test).AutoComplete(liste_tags), g.Custom(func() { if g.IsKeyPressed(g.KeyEnter) && g.IsItemActive() { fmt.Println("Enter") } }),
To Reproduce
- Run my demo
Version
v0.6.1
OS
Linux Manjaro
~~@schabil I'd suggest you to try with (*InputTextMultilineWidget).Callback(...)~~ well it doesn't work
btw @AllenDang IMO imgui.InputTextCallbackData needs some API in giu
it was resolved in #660