Is it possible to tell if a user is using a hardware keyboard vs. the onscreen keyboard? I’ve dug around and I can’t seem to find anything, but this would be a very useful feature.
For my part, I’d like to know this so that, if using the onscreen keyboard, I can shift my typing area into view if needed, but if using a hardware keyboard, I wouldn’t need to do anything.
UIKit has a nice feature where you can set a callback, and whenever the keyboard is displayed/hidden, it calls that callback with information about how the keyboard is going to be displayed: it’s ending frame size, the animation curve used to show/hide the display, and some other stuff I can’t remember. This is awesome because you can synchronize your view’s animation with the on screen keyboard if necessary.
If there current is no functionality to detect hw/sw keyboard, I propose that the callback feature be added to the feature tracker. If there is, please point me to it so I can use it
I haven’t tried it, but I think you can figure it out since the HEIGHT value changes if it is an onscreen keyboard.
I never noticed the height value change! Very interesting!
Actually I tried that…it didn’t seem to change.
EDIT: I tried it again as a sanity check…it most definitely does not change the HEIGHT value when the onscreen keyboard is presented.
@toadkick having access to the keyboard height is important. Do you have any ideas about how you could see the API looking on this functionality?
@Simeon: I’m thinking that whenever the keyboard shows/hides, Codea could check for these global callbacks and execute them if they exist:
function keyboardWillShow(height, duration, easing)
function keyboardWillHide(duration, easing)
The easing is not strictly necessary, but would be nice to have if Codea can map the easing curve used by UIKit to a corresponding easing mode for tween.lua.
I’m not sure whether the entire frame (rect) for they keyboard or just the height is needed, but I suspect that just the height should be enough.
I’m definitely open to suggestions, they may be better ways to handle this.
it would, finally, be so great, if HEIGHT would change when software-keyboard is showing - or TTL exposes the keyboard position vector (which is ‘nil’ when ‘not isShowingKeyboard()’)
@se24vad definitely the second one, a lot of my code relies on HEIGHT for positioning objects, they’d get squashed at the bottom of the screen behind the keyboard if this was the case. Does the second one give a different vector or remain nil with hard keyboard
Hello, just revisiting this post… is there a way to detect on screen keyboard versus external now ?
my app is displaying text and scrolling but the text is going either behind the keyboard or there is a big blank at the bottom if I use an external keyboard and try to rely on isKeyboardShowing(). Any idea ?
@dlpnet As far as I know, there isn’t a way to detect the external keyboard yet. I never use an external keyboard, but I recently bought a $1 external keyboard just to try it. It works OK, but I prefer the built in keyboard. Anyways, I used the external keyboard and I couldn’t figure out a way to detect if the external or the built in keyboard was being used. For now, maybe you can use the
parameter.boolean to select whether the built in or external keyboard is being used.
PS. Any code you use for the
parameter.boolean could be used when code is added to detect the external keyboard.
I will expose the height of the keyboard in a future release, either through the
layout module or elsewhere.
Excellent and layout seems fine. Thank you
@Simeon it be great to also add a fully keyboard set to it (types), as an example:
- LINK could have a .com button near to the space bar,
- PHONE would only show the
- EMAIL could already show the @-character on the first page of the keyboard.
- PASSWORD, NAME AND SIRNAME (But also PASSWORD and PHONE) could suggest the correct data from your suggested words.
But generally, a fully customizable keyboard would be preferred.