Issues using bluetooth keyboard (iOS)
When trying to use a Bluetooth keyboard under iOS, input will often get stuck repeating the last few characters. Turning off the Bluetooth keyboard does not stop the repeats.
I'm sorry, but there isn't much I can do about this. I have tested a little with iOS keyboards, but they simply do not follow the standards needed for web development. In fact, very often, Apple products deliberately escape from standards in order to keep people hostage to their products, you know.
In this particular example, the keyboard simply does not report the event of the key being released. The emulator knows when you press a key, but its impossible to know when you release it. In other words: you can type characters in Apple applications or on the web browser, but its not designed to be used in applications that need direct control over the separate "pressed" and "released" states of each key (like emulators do). Its a pity...
I plan to test some more with these keyboards, maybe I could find an alternate solution, but I do not have easy access to the complete setup to work on this.
Do you have any ideas or information about this limitation I found in my tests? Is it really this way?
Thanks! This makes sense. I was aware of only having button down years ago when I wrote code to plug in an Atari joystick thought an adapter that made it look like a USB keyboard device. (It was a great discovery back then realizing you could use some USB devices on the iPad.)
Since I just tested and see there is no key repeat, I suppose this must still be the case. This is the same issue I have found with a $4 USB host chip I am using for a project. Their keyboard layer translates USB keyboard to ASCII, and also is lacking key up.
With that said, perhaps a mode where it treats a keydown as a keydown/keyup would suffice. It wouldn’t allow for CTRL-x keys, or keyboard games, but would be enouhg for typing in BASIC programs.
(I found your emulator the other night, when I was looking for a way to learn how MSX-BASIC handles its PLAY music command. It has provided great insight without having to download an emulator. Very impressive!)
Actually, scratch that. This may be possible. I just found out there is even a key repeat option for hardware keyboards in iOS. I will look into this and get back to you.
It looks like it can be done after all! I’ll find out how, and maybe it won’t be some off-standard thing that is easy to implement if you feel inclined.
keydown keyCode=76 (L) which=76 (L) charCode=0
keypress keyCode=76 (L) which=76 (L) charCode=76 (L)
textInput data=L
keyup keyCode=0 which=0 charCode=0
It looks like keyup is detectable. I found this sample at w3schools:
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onkeypress
Change it to “onkeyup” and when I hold down a key, nothing happens, and as soon as I release, the pop up alert shows up. Looks like Apple must have changed this at some point, or I just didn’t know about it years ago.
The problem is the "keyup keyCode=0 which=0 charCode=0", you see?
On Tue, Feb 20, 2018 at 9:04 PM, Allen Huffman [email protected] wrote:
It looks like it can be done after all! I’ll find out how, and maybe it won’t be some off-standard thing that is easy to implement if you feel inclined.
keydown keyCode=76 (L) which=76 (L) charCode=0 keypress keyCode=76 (L) which=76 (L) charCode=76 (L) textInput data=L keyup keyCode=0 which=0 charCode=0
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ppeccin/WebMSX/issues/31#issuecomment-367165433, or mute the thread https://github.com/notifications/unsubscribe-auth/AArloPRLTQzJSCcHGv5Fp_TEHymf9Xwkks5tW114gaJpZM4SMqRU .
With this example you found that some key was released, but not WHICH key, which is fundamental for the emulator.
On Tue, Feb 20, 2018 at 9:13 PM, Allen Huffman [email protected] wrote:
It looks like keyup is detectable. I found this sample at w3schools:
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onkeypress
Change it to “onkeyup” and when I hold down a key, nothing happens, and as soon as I release, the pop up alert shows up. Looks like Apple must have changed this at some point, or I just didn’t know about it years ago.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ppeccin/WebMSX/issues/31#issuecomment-367167381, or mute the thread https://github.com/notifications/unsubscribe-auth/AArloIxGftR870YXE6Ub5sXUqr7cMvoWks5tW1-RgaJpZM4SMqRU .
Oddly, it works using the on-screen keyboard! Go figure. If I run across anything different, I will reply. Until then... Thanks for all your work!
What on screen keyboard? The one directly inside the emulator you mean?
On Tue, Feb 20, 2018 at 11:21 PM, Allen Huffman [email protected] wrote:
Oddly, it works using the on-screen keyboard! Go figure. If I run across anything different, I will reply. Until then... Thanks for all your work!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ppeccin/WebMSX/issues/31#issuecomment-367192214, or mute the thread https://github.com/notifications/unsubscribe-auth/AArloNHcTCMvG87MKg8bPyopNy8rP8EYks5tW32hgaJpZM4SMqRU .
The built-in iOS on-screen keyboard. You can hold down a key for a few seconds, then when you release the script returns the proper keyup. However, the Bluetooth keyboard does not.
I keep seeing example code that shows how to ensure you detect the keyup for the same keydown, but I don't think it would work for "real" use. I am going to test it today.
Remember you can always use the Text Input feature of WebMSX. There you will be able to type and edit normal characters using any means available, in a normal text entering field, then the emulator "inserts" the text on the MSX machine. It may suffice for your needs.
On Wed, Feb 21, 2018 at 12:07 PM, Allen Huffman [email protected] wrote:
The built-in iOS on-screen keyboard. You can hold down a key for a few seconds, then when you release the script returns the proper keyup. However, the Bluetooth keyboard does not.
I keep seeing example code that shows how to ensure you detect the keyup for the same keydown, but I don't think it would work for "real" use. I am going to test it today.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ppeccin/WebMSX/issues/31#issuecomment-367356133, or mute the thread https://github.com/notifications/unsubscribe-auth/AArloNSaZhtH4NJbfn1bC2_HhrsVFbGsks5tXDEVgaJpZM4SMqRU .
Yes - very useful. Thanks for your time.
No problem. It would really be very nice if all iOS keyboards could work. Please let me know if you find something!
On Wed, Feb 21, 2018 at 12:25 PM, Allen Huffman [email protected] wrote:
Yes - very useful. Thanks for your time.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ppeccin/WebMSX/issues/31#issuecomment-367362246, or mute the thread https://github.com/notifications/unsubscribe-auth/AArloA3Zqddx6WP3gunAAqKkZPxXHAaCks5tXDVUgaJpZM4SMqRU .
iOS bug... keydown and keyup events support is really crappy. Its impossible to track key state. Waiting for Apple to fix this.