Jump to content

[FIXED] Alpha: Edit Box key press keycode differences

Recommended Posts

  • Administrators

This is, what I wrote on the Smart Mobile Studio Facebook page a while ago:


Some people are just way too pedantic. While testing I noticed that my Android phone did not trigger OnKeyPress. While investigating I found a lot of Google hits on the same problem. As people can speak to input text or write multi-char smileys, someone thought that it's a great idea to deprecate an event, that has been used ever since computers had more than 1 MB of memory.

There were a lot of suggestions on how to work around this. Many suggest to use OnInput (which will be introduced in the next update, along this fix), but basically only one browser included the pressed key in the event. Some suggested to store the text at OnKeyDown and to compare the contents at OnKeyUp.

Long story short: In the future we'll listen to both OnKeyPress and OnInput. If OnKeyPress was not triggered or the key was not found, we try to find the key during OnInput. If we do find it, we simulate a OnKeyPress.

Oh, and OnKeyPress contains the changed key. But what happens when you write a smiley on mobile? The whole smiley is sent even though it's longer than one character. If someone thinks that's a problem, please do smile more 1f642.png

Works in all browsers, iOS, Android and Windows mobile.

Now, when you press enter, you actually don't get 69. You get five characters: 69, 110, 116, 101, 114

When you print those characters, it's spelled out: Enter

Now, well... I suppose I could convert that internally to #13 :-)

Link to post
Share on other sites
  • Administrators
3 minutes ago, recursiveElk said:

Yeah any solution works and i've seen a lot of debate on either side of chromium forums on the issue. Just wanted to alert for the sake of consistency moving forward. 

Thank you for doing it. I appreciate it. The aim of SMS is to solve all these kinds of issues and differences inside the RTL so that programmers don't have to write platform specific code. So I'll be more than happy to test and fix any issues like these :-)

Link to post
Share on other sites
  • recursiveElk changed the title to [FIXED] Alpha: Edit Box key press keycode differences

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...