Coder Social home page Coder Social logo

Comments (7)

kwhat avatar kwhat commented on July 29, 2024

Are you using get getKeyCode() on a key down or up events? That functionality behaves the same way as the java key listener, "getKeyChar() for events of type NATIVE_KEY_PRESSED and NATIVE_KEY_RELEASED will always return CHAR_UNDEFINED."

See:

* <code>VC_UNDEFINED</code>. Please note that {@link #getKeyChar()} for events of type

from jnativehook.

firster8 avatar firster8 commented on July 29, 2024

I get UNDEFINED on key typed when I want to get the Key Code.

from jnativehook.

kwhat avatar kwhat commented on July 29, 2024

What Operating system and which key?

from jnativehook.

CorpWar avatar CorpWar commented on July 29, 2024

I have the same problem, in public void nativeKeyTyped(NativeKeyEvent nativeKeyEvent) the nativeKeyEvent.getKeyCode() always return 0. It is working on nativeKeyPressed and on nativeKeyReleased. I run Win 7. I get this an all keys.

from jnativehook.

kwhat avatar kwhat commented on July 29, 2024

Ahh yes, that is not a bug. For some reason I read getKeyCode and thought getKeyChar. Key down and up events produce "codes" and key typed events produce "chars." Key down/up events will always have a char of CHAR_UNDEFINED and key typed events will always have a code of VK_UNDEFINED. This should match the behavior of Java's KeyEvent.

from jnativehook.

CorpWar avatar CorpWar commented on July 29, 2024

I thought it was something like that. So work as intended. It would be good to add this in the documentation in NativeKeyEvent that only some information are used in some method and you can't use all the method from this class.
Thanks for explaining, I'm good so you can close for me.

from jnativehook.

kwhat avatar kwhat commented on July 29, 2024

I will update the docs this weekend and close. You are welcome.

from jnativehook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.