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

Key events #226

Closed
AidasK opened this issue Feb 19, 2015 · 4 comments
Closed

Key events #226

AidasK opened this issue Feb 19, 2015 · 4 comments

Comments

@AidasK
Copy link

AidasK commented Feb 19, 2015

How to submit form on enter click?
The following code works, but I don't know how to get a key code

password := gtk.NewEntry()  
password.Connect("key-press-event", func(d interface{}) {    
fmt.Println("press", d)
});
@mattn
Copy link
Owner

mattn commented Feb 20, 2015

Use emit.

password.Emit("event-name-you-want")

@AidasK
Copy link
Author

AidasK commented Feb 20, 2015

For my understanding, emit will create an event and will notify all the listeners. What I want, is to catch Enter key event. I have login dialog, once password is entered, user can press enter to submit the form for convenience, instead of pressing login button with mouse. My provided code does catch key events, but I need some documentation about arguments passed to callback (in my case it is d interface{}). I need to get a key code from d. Thanks for any help.

@mattn
Copy link
Owner

mattn commented Feb 20, 2015

@AidasK
Copy link
Author

AidasK commented Feb 20, 2015

Thanks for a quick reply, works like a charm

@AidasK AidasK closed this as completed Feb 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants