SDL icon indicating copy to clipboard operation
SDL copied to clipboard

Is it possible to activate the keyboard hint on iOS?

Open barisyild opened this issue 1 year ago • 5 comments

The keyboard looks like the one below, is there any way to activate the hint?

image

barisyild avatar Apr 03 '24 09:04 barisyild

This is a good question for the SDL discussion group: http://discourse.libsdl.org/

The quick answer is that you should use SDL_StartTextInput()

slouken avatar Apr 03 '24 14:04 slouken

This is not what I'm talking about, when I use "SDL_StartTextInput" I don't get keyboard suggestions like in the image. (predictive text)

image

So the keyboard gives no hint in SDL.

barisyild avatar Apr 04 '24 10:04 barisyild

We probably need to add some flags to SDL_StartTextInput() to define the style of input we want.

slouken avatar Apr 04 '24 14:04 slouken

We probably need to add some flags to SDL_StartTextInput() to define the style of input we want.

If this is possible to do it would be great because the Android keyboard used to be "Password" mode, which has no hint, and later was changed for "multiline" which has hint, in SDL2 (I think 2.24 version) and this change changes everything on how one would handle the received input.

I've had to patch the Android side of SDL2 since then, so having this available in the API itself in SDL3 would help!

ericoporto avatar Apr 05 '24 12:04 ericoporto

you could find the text field object at runtime and modify its configuration to your needs, something like this:

// root VC has class SDL_uikitviewcontroller
for (UIView* v in UIApplication.sharedApplication.keyWindow.rootViewController.view) {
  if (![v isKindOfClass:[UITextField class]])
    continue;
  UITextField* sdlTextField = (UITextField*)v;
  // now adjust properties of sdlTextField
  break;
}

kambala-decapitator avatar Jun 14 '24 11:06 kambala-decapitator

Showing suggestions is now the default behavior in SDL3, and you can customize this with SDL_StartTextInputWithProperties()

slouken avatar Aug 02 '24 21:08 slouken