Anixias
Member
Hi, all.
I'm attempting to make a robust textbox system using keyboard_lastchar. This works automatically with backspaces as long as you handle "\b" as removing the character the cursor is on rather than literally adding the character "\b" to the string. It also automatically works with holding backspace down: it deletes a character, then after a short time, rapidly deletes characters until the key is released.
I was perplexed to discover that the Delete key does not affect keyboard_lastchar in any way, yet Ctrl+F maps to \x06 where just F maps to \x46 and f maps to \x66. I found out that Ctrl+Backspace is the non-breaking space character \x7F. I decided I would use that to simulate the Delete key, which would automatically work the same way Backspace had. However, calling keyboard_set_map(vk_delete, ord("\x7F")) does not cause the delete key to affect keyboard_lastchar.
I just find it odd that the Delete key (and Home, Insert, etc.) have no affect over keyboard_lastchar, even if you map the key to some other unicode value. I tested it further by mapping vk_delete to vk_backspace, but still no effect. keyboard_string obviously does not detect Delete either. I thought about using keyboard_key to artificially set keyboard_lastchar to "\x7F" but, as far as I'm aware, this would not cause the automatic behavior of simulating once, waiting a short time, and then simulating multiple times until key release.
Now, of course, I can just artificially add that functionality in myself, but I wanted to check with the forum to see if anyone had any light to shed on the issue before I do it the manual way.
I'm attempting to make a robust textbox system using keyboard_lastchar. This works automatically with backspaces as long as you handle "\b" as removing the character the cursor is on rather than literally adding the character "\b" to the string. It also automatically works with holding backspace down: it deletes a character, then after a short time, rapidly deletes characters until the key is released.
I was perplexed to discover that the Delete key does not affect keyboard_lastchar in any way, yet Ctrl+F maps to \x06 where just F maps to \x46 and f maps to \x66. I found out that Ctrl+Backspace is the non-breaking space character \x7F. I decided I would use that to simulate the Delete key, which would automatically work the same way Backspace had. However, calling keyboard_set_map(vk_delete, ord("\x7F")) does not cause the delete key to affect keyboard_lastchar.
I just find it odd that the Delete key (and Home, Insert, etc.) have no affect over keyboard_lastchar, even if you map the key to some other unicode value. I tested it further by mapping vk_delete to vk_backspace, but still no effect. keyboard_string obviously does not detect Delete either. I thought about using keyboard_key to artificially set keyboard_lastchar to "\x7F" but, as far as I'm aware, this would not cause the automatic behavior of simulating once, waiting a short time, and then simulating multiple times until key release.
Now, of course, I can just artificially add that functionality in myself, but I wanted to check with the forum to see if anyone had any light to shed on the issue before I do it the manual way.