Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[howTo] Respond to enter key in an input box #460

Closed
schabil opened this issue Feb 16, 2022 · 2 comments
Closed

[howTo] Respond to enter key in an input box #460

schabil opened this issue Feb 16, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@schabil
Copy link

schabil commented Feb 16, 2022

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

  1. Run my demo

Version

v0.6.1

OS

Linux Manjaro

@schabil schabil added the bug Something isn't working label Feb 16, 2022
@gucio321
Copy link
Collaborator

gucio321 commented Feb 16, 2022

@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

@gucio321
Copy link
Collaborator

gucio321 commented May 8, 2023

it was resolved in #660

@gucio321 gucio321 closed this as completed May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants