LastKeyCode is wrong in nwjs on Mac!

0 favourites
  • 6 posts
From the Asset Store
Be quick and choose whether the shown equation is right or wrong.
  • Howdy CPeeps! I have a Construct 2 nwjs app on Mac (LastKeyCode) that will detect the numpad keys as non-numeric keys.

    So, pressing 5 on the numpad should detect 101 but will be seen as 53.

    Here's the interesting part:

      An html5 of the same project running in Safari on the same Mac does not have the problem. nwjs on Win64 does not have the problem.

    My favorite part:

    If I use Javascript within the Construct project to echo the key events as an alert:

    document.body.addEventListener('keyup', function (evt) {
            console.log(evt.code);
    });[/code:24nk49id]
    
    The java alert will echo [b]correctly [/b]on the Mac in nwjs, but LastKeyCode is still incorrect!!!
    Here's a test web app that alerts the Java KeyPress and displays LastKeyCode (should work fine): [url=http://www.divertigo.com/keycodehtml/]LINK[/url]
    Mac nwjs package for the same but the printed LastKeyCode should be wrong [url=http://www.divertigo.com/keycodehtml/lastkey.zip]Mac NWJS Package[/url]
    capx of the test (its two lines) [url=http://www.divertigo.com/keycodehtml/keytestcapx.zip]HERE[/url]
    
    Here's some information that may be relavant: 
    I'm building an nwjs app, then copying the files to a Mac share.  Because I'm experiencing the crash issue noted in [url=https://www.scirra.com/forum/built-macos-app-crashes-on-load_t193562]80bit's post[/url] I am having to copy the resources folder to a 0.25.3 (normal) package download from nwjs.io.
    
    Construct 2 r244 (Win64)
    nwjs / 0.24.0 and 0.25.0
    Mac clients: 10.11.6, have also tried High Sierra.
    
    I don't like the fact that I have to hodgepodge an nwjs package together to get this thing to run without crashing.. that could be part of the issue.. but it's awfully strange that LastKeyCode is tanking like that.  Curious if anyone has encountered something similar.
    
    While we're at it.. is anyone having success with nwjs on Mac without some sort of dorky workaround?
    Thanks! -Steve
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Update:

    I installed nwjs 21.1 and the nwjs app launches without any required modification, but the same problem exists.

    The num keys are recognized as non-numeric keys in my nwjs app on Mac by Construct.

    Javascript key recognition works fine.

    Safari on Mac or nwjs on Windows don't have the problem.

    Anyone fancy a guess?

  • Hello, I do not have Mac but ... is it a bug ?, why do not you write a form ?.

  • Aye. It is feeling buggish.. I don't have mac either, save virtual. I'll have this tested on a real mac (it will fail) and likely file a defect. Your avatar is pleasing.

  • Posted a defect entry here. Wish me fortune.

  • Here's an update in case someone happens across this thread on a search.

    This is what is observed (on Mac nw.js) alltogether:

      C2's Keyboard.LastKeyCode is incorrect for numpad keys browser.execjs("event.code") is correct for numpad keys browser.execjs("event.keyCode") is incorrect for numpad keys.

    Example: LastKey2.zip

    Therefore, it seems that a workaround to properly detect numkeys on Mac nw.js is to leverage event.code from JavaScript and manually derive a keycode from that.

    Lastly, I can also reproduce this on Mac outside of nw.js using the latest version of Chrome (62.0.3202.75)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)