LastKeyCode is wrong in nwjs on Mac!

Discussion and feedback on Construct 2

Post » Fri Sep 29, 2017 1:48 am

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:
Code: Select all
document.body.addEventListener('keyup', function (evt) {
        console.log(evt.code);
});


The java alert will echo correctly 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): LINK
Mac nwjs package for the same but the printed LastKeyCode should be wrong Mac NWJS Package
capx of the test (its two lines) HERE

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 80bit's post 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
Last edited by Stweve on Wed Oct 11, 2017 6:14 am, edited 1 time in total.
B
29
S
11
Posts: 34
Reputation: 2,056

Post » Wed Oct 11, 2017 6:13 am

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?
B
29
S
11
Posts: 34
Reputation: 2,056

Post » Wed Oct 11, 2017 7:47 pm

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

bugs_f151
B
37
S
15
G
22
Posts: 961
Reputation: 15,257

Post » Wed Oct 11, 2017 7:51 pm

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.
B
29
S
11
Posts: 34
Reputation: 2,056

Post » Mon Oct 16, 2017 11:41 pm

Posted a defect entry here. Wish me fortune.
B
29
S
11
Posts: 34
Reputation: 2,056

Post » Sat Nov 04, 2017 5:51 am

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)
B
29
S
11
Posts: 34
Reputation: 2,056


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests