On-screen keyboard change

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced SDL_ShowScreenKeyboard() and
SDL_HideScreenKeyboard() with SDL_StartTextInput() and SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen keyboard
if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen keyboard
if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput() when
you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam

1 Like

Also, I noticed that currently the SDL iOS keyboard will hide itself when
you press return. It seems like this makes it worthless for multi-line
text fields.

How do people feel about changing it so it always stays up until you call
SDL_StopTextInput(), which you should do in response to a return key event?
FWIW, that’s the way the Android implementation works right now.On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga <@slouken> wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen keyboard
if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput() when
you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam

Does the keyboard hide on its own because of iOS or because SDL is
programmed to do that?

2012/11/5 Sam Lantinga :> Also, I noticed that currently the SDL iOS keyboard will hide itself when

you press return. It seems like this makes it worthless for multi-line text
fields.

How do people feel about changing it so it always stays up until you call
SDL_StopTextInput(), which you should do in response to a return key event?
FWIW, that’s the way the Android implementation works right now.

On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen keyboard
if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput() when
you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL is programmed to do that.On Sun, Nov 4, 2012 at 11:01 PM, Sik the hedgehog < sik.the.hedgehog at gmail.com> wrote:

Does the keyboard hide on its own because of iOS or because SDL is
programmed to do that?

2012/11/5 Sam Lantinga <@slouken>:

Also, I noticed that currently the SDL iOS keyboard will hide itself when
you press return. It seems like this makes it worthless for multi-line
text
fields.

How do people feel about changing it so it always stays up until you call
SDL_StopTextInput(), which you should do in response to a return key
event?
FWIW, that’s the way the Android implementation works right now.

On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga <@slouken> wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been
folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen
keyboard
if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput()
when
you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Oh well, then yeah, I think it should hide only when SDL_StopTextInput
is called. The more consistent, the better. (note: never programmed
for phones, just suggesting based on those comments)

2012/11/5 Sam Lantinga :> SDL is programmed to do that.

On Sun, Nov 4, 2012 at 11:01 PM, Sik the hedgehog <@Sik_the_hedgehog> wrote:

Does the keyboard hide on its own because of iOS or because SDL is
programmed to do that?

2012/11/5 Sam Lantinga :

Also, I noticed that currently the SDL iOS keyboard will hide itself
when
you press return. It seems like this makes it worthless for multi-line
text
fields.

How do people feel about changing it so it always stays up until you
call
SDL_StopTextInput(), which you should do in response to a return key
event?
FWIW, that’s the way the Android implementation works right now.

On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been
folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen
keyboard
if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput()
when
you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I welcome the API change, Sam!
For the multiline problem, how about a SDL_Hint, or passing a bool to
the ShowScreenKeyboard
function?

VittorioOn Mon, Nov 5, 2012 at 7:54 AM, Sam Lantinga wrote:

Also, I noticed that currently the SDL iOS keyboard will hide itself when
you press return. It seems like this makes it worthless for multi-line
text fields.

How do people feel about changing it so it always stays up until you call
SDL_StopTextInput(), which you should do in response to a return key event?
FWIW, that’s the way the Android implementation works right now.

On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen
keyboard if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput()
when you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Which is useless because the program could just do StopTextInput when
it detects enter if needed (given it’s already handling the GUI after
all). The function was just hardcoded to close for no real reason.

2012/11/5 Vittorio Giovara <vitto.giova at yahoo.it>:> I welcome the API change, Sam!

For the multiline problem, how about a SDL_Hint, or passing a bool to the
ShowScreenKeyboard function?

Vittorio

On Mon, Nov 5, 2012 at 7:54 AM, Sam Lantinga wrote:

Also, I noticed that currently the SDL iOS keyboard will hide itself when
you press return. It seems like this makes it worthless for multi-line text
fields.

How do people feel about changing it so it always stays up until you call
SDL_StopTextInput(), which you should do in response to a return key event?
FWIW, that’s the way the Android implementation works right now.

On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen
keyboard if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput()
when you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Well I would never define a usecase ‘useless’, there are applications that
need multiline input and other the don’t: in the first case the current
implementation is problematic but for the second one it is perfect.
Plus writing a single line “SDL_setHint(“HideKeyboardOnReturn”)” is MUCH
easier than to handle the response of a keypress event (and some
applications don’t do that altogether):

Anyway, in my opinion any solution is fine as long as it’s consistent and
uniform on iOS/Android.
Bye,
VittorioOn Mon, Nov 5, 2012 at 10:12 AM, Sik the hedgehog < sik.the.hedgehog at gmail.com> wrote:

Which is useless because the program could just do StopTextInput when
it detects enter if needed (given it’s already handling the GUI after
all). The function was just hardcoded to close for no real reason.

2012/11/5 Vittorio Giovara <vitto.giova at yahoo.it>:

I welcome the API change, Sam!
For the multiline problem, how about a SDL_Hint, or passing a bool to the
ShowScreenKeyboard function?

Vittorio

On Mon, Nov 5, 2012 at 7:54 AM, Sam Lantinga wrote:

Also, I noticed that currently the SDL iOS keyboard will hide itself
when
you press return. It seems like this makes it worthless for multi-line
text
fields.

How do people feel about changing it so it always stays up until you
call
SDL_StopTextInput(), which you should do in response to a return key
event?
FWIW, that’s the way the Android implementation works right now.

On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been
folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen
keyboard if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput()
when you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

As far as I know you are given every character in its own event
anyway, and handling the enter key would just be part of that.

Which brings me to another point, the text input events have nearly
non-existent documentation other than the functions and structs exist,
it’s impossible to tell how they work until you actually use them -
and even then you’re bound to get it wrong (especially with
SDL_SetTextInputRect, what is it meant to set exactly? trial and error
won’t work because I could end up hitting some undefined behavior by
accident and it break later on other platforms or later SDL versions)

Also I’d rather pass it as a parameter if implemented, since hints are
for things that stay the same across the execution (and them changing
in the middle is an exception to the rule), as well as being able to
be set by environment variables (so you should avoid messing with them
unless strictly required), while single and multiline edits are both
pretty common - you may even need both at the same time (e.g. a form
with multiple fields, some single line and some multiline).

2012/11/6 Vittorio Giovara <vitto.giova at yahoo.it>:> Well I would never define a usecase ‘useless’, there are applications that

need multiline input and other the don’t: in the first case the current
implementation is problematic but for the second one it is perfect.
Plus writing a single line “SDL_setHint(“HideKeyboardOnReturn”)” is MUCH
easier than to handle the response of a keypress event (and some
applications don’t do that altogether):

Anyway, in my opinion any solution is fine as long as it’s consistent and
uniform on iOS/Android.
Bye,
Vittorio

On Mon, Nov 5, 2012 at 10:12 AM, Sik the hedgehog <@Sik_the_hedgehog> wrote:

Which is useless because the program could just do StopTextInput when
it detects enter if needed (given it’s already handling the GUI after
all). The function was just hardcoded to close for no real reason.

2012/11/5 Vittorio Giovara <vitto.giova at yahoo.it>:

I welcome the API change, Sam!
For the multiline problem, how about a SDL_Hint, or passing a bool to
the
ShowScreenKeyboard function?

Vittorio

On Mon, Nov 5, 2012 at 7:54 AM, Sam Lantinga wrote:

Also, I noticed that currently the SDL iOS keyboard will hide itself
when
you press return. It seems like this makes it worthless for multi-line
text
fields.

How do people feel about changing it so it always stays up until you
call
SDL_StopTextInput(), which you should do in response to a return key
event?
FWIW, that’s the way the Android implementation works right now.

On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced
SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are
accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been
folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen
keyboard if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput()
when you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

There are some docs on the wiki:
http://wiki.libsdl.org/moin.cgi/Tutorials/TextInput

– drawocOn Tue, Nov 6, 2012 at 5:26 AM, Sik the hedgehog <sik.the.hedgehog at gmail.com> wrote:

As far as I know you are given every character in its own event
anyway, and handling the enter key would just be part of that.

Which brings me to another point, the text input events have nearly
non-existent documentation other than the functions and structs exist,
it’s impossible to tell how they work until you actually use them -
and even then you’re bound to get it wrong (especially with
SDL_SetTextInputRect, what is it meant to set exactly? trial and error
won’t work because I could end up hitting some undefined behavior by
accident and it break later on other platforms or later SDL versions)

Also I’d rather pass it as a parameter if implemented, since hints are
for things that stay the same across the execution (and them changing
in the middle is an exception to the rule), as well as being able to
be set by environment variables (so you should avoid messing with them
unless strictly required), while single and multiline edits are both
pretty common - you may even need both at the same time (e.g. a form
with multiple fields, some single line and some multiline).

2012/11/6 Vittorio Giovara <vitto.giova at yahoo.it>:

Well I would never define a usecase ‘useless’, there are applications that
need multiline input and other the don’t: in the first case the current
implementation is problematic but for the second one it is perfect.
Plus writing a single line “SDL_setHint(“HideKeyboardOnReturn”)” is MUCH
easier than to handle the response of a keypress event (and some
applications don’t do that altogether):

Anyway, in my opinion any solution is fine as long as it’s consistent and
uniform on iOS/Android.
Bye,
Vittorio

On Mon, Nov 5, 2012 at 10:12 AM, Sik the hedgehog <sik.the.hedgehog at gmail.com> wrote:

Which is useless because the program could just do StopTextInput when
it detects enter if needed (given it’s already handling the GUI after
all). The function was just hardcoded to close for no real reason.

2012/11/5 Vittorio Giovara <vitto.giova at yahoo.it>:

I welcome the API change, Sam!
For the multiline problem, how about a SDL_Hint, or passing a bool to
the
ShowScreenKeyboard function?

Vittorio

On Mon, Nov 5, 2012 at 7:54 AM, Sam Lantinga wrote:

Also, I noticed that currently the SDL iOS keyboard will hide itself
when
you press return. It seems like this makes it worthless for multi-line
text
fields.

How do people feel about changing it so it always stays up until you
call
SDL_StopTextInput(), which you should do in response to a return key
event?
FWIW, that’s the way the Android implementation works right now.

On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced
SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are
accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been
folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen
keyboard if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput()
when you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

It still isn’t very clear: I’m still clueless as to what
SDL_SetTextInputRect should specify exactly (in fact the tutorial and
the reference for said function even seem to contradict each other).

Also back on-topic, I was wondering: if the keyboard closes on its
own, how does the program know it happened? Since text input should
stop there after all.

2012/11/6 drawoc :> There are some docs on the wiki:

http://wiki.libsdl.org/moin.cgi/Tutorials/TextInput

– drawoc

On Tue, Nov 6, 2012 at 5:26 AM, Sik the hedgehog <@Sik_the_hedgehog> wrote:

As far as I know you are given every character in its own event
anyway, and handling the enter key would just be part of that.

Which brings me to another point, the text input events have nearly
non-existent documentation other than the functions and structs exist,
it’s impossible to tell how they work until you actually use them -
and even then you’re bound to get it wrong (especially with
SDL_SetTextInputRect, what is it meant to set exactly? trial and error
won’t work because I could end up hitting some undefined behavior by
accident and it break later on other platforms or later SDL versions)

Also I’d rather pass it as a parameter if implemented, since hints are
for things that stay the same across the execution (and them changing
in the middle is an exception to the rule), as well as being able to
be set by environment variables (so you should avoid messing with them
unless strictly required), while single and multiline edits are both
pretty common - you may even need both at the same time (e.g. a form
with multiple fields, some single line and some multiline).

2012/11/6 Vittorio Giovara <vitto.giova at yahoo.it>:

Well I would never define a usecase ‘useless’, there are applications that
need multiline input and other the don’t: in the first case the current
implementation is problematic but for the second one it is perfect.
Plus writing a single line “SDL_setHint(“HideKeyboardOnReturn”)” is MUCH
easier than to handle the response of a keypress event (and some
applications don’t do that altogether):

Anyway, in my opinion any solution is fine as long as it’s consistent and
uniform on iOS/Android.
Bye,
Vittorio

On Mon, Nov 5, 2012 at 10:12 AM, Sik the hedgehog <@Sik_the_hedgehog> wrote:

Which is useless because the program could just do StopTextInput when
it detects enter if needed (given it’s already handling the GUI after
all). The function was just hardcoded to close for no real reason.

2012/11/5 Vittorio Giovara <vitto.giova at yahoo.it>:

I welcome the API change, Sam!
For the multiline problem, how about a SDL_Hint, or passing a bool to
the
ShowScreenKeyboard function?

Vittorio

On Mon, Nov 5, 2012 at 7:54 AM, Sam Lantinga wrote:

Also, I noticed that currently the SDL iOS keyboard will hide itself
when
you press return. It seems like this makes it worthless for multi-line
text
fields.

How do people feel about changing it so it always stays up until you
call
SDL_StopTextInput(), which you should do in response to a return key
event?
FWIW, that’s the way the Android implementation works right now.

On Sun, Nov 4, 2012 at 10:52 PM, Sam Lantinga wrote:

I just checked in a pretty big change to the on-screen keyboard API.

The quick and dirty version is that I replaced
SDL_ShowScreenKeyboard()
and SDL_HideScreenKeyboard() with SDL_StartTextInput() and
SDL_StopTextInput().

Here are the full notes:

Synchronized the on-screen keyboard state with whether we are
accepting
text input.
The functions to show/hide/toggle the on-screen keyboard have been
folded
into the text input state.
Calling SDL_StartTextInput() will automatically show the on-screen
keyboard if it’s available.
Calling SDL_StopTextInput() will automatically hide the on-screen
keyboard if it’s available.
There is a new API function SDL_IsTextInputActive() which will return
whether text input is currently active.
Text input is disabled by default, you must call SDL_StartTextInput()
when you are ready to accept text input.
SDL_HasScreenKeyboardSupport() no longer needs to be passed a window.
The iPhone-specific on-screen keyboard functions have been removed.

Cheers!
–Sam


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hi Sam, I have just downloaded this update. (8 - Nov update)

The update has fixed some file issues that I was having. But now the keyboard is showing up when my application starts; I have commented out my code that calls the keyboard and that hasn’t fixed the problem.
Can you think of what might be the problem?

Also is there a way that I can get the size of the soft keyboard, as I would like to adjust my screen when the keyboard is visible.

Cheers
Brad

What platform are you running on?
I put a couple fixes in, can you try the latest snapshot?
http://www.libsdl.org/tmp/SDL-2.0.zip

There currently isn’t any API to get the size of the on-screen keyboard,
though I agree that would be useful. Patches welcome! :)On Mon, Nov 12, 2012 at 7:31 PM, BJ wrote:

**
Hi Sam, I have just downloaded this update. (8 - Nov update)

The update has fixed some file issues that I was having. But now the
keyboard is showing up when my application starts; I have commented out my
code that calls the keyboard and that hasn’t fixed the problem.
Can you think of what might be the problem?

Also is there a way that I can get the size of the soft keyboard, as I
would like to adjust my screen when the keyboard is visible.

Cheers
Brad


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The platform is Android. I am just downloading the latest now.

I’ll let you know how it goes.

Cheers
Brad

Ok, the good news is that the keyboard no longer shows on start up.

Some suggestions, currently when the back button is pressed the engine has no record of this press if the keyboard is visible. The button event is received if the keyboard is hidden.
The other one is to get the height of the keyboard when visible.

I need both of these so that I can adjust the screen when the keyboard is visible and return it to normal when it isn’t.

I am very new to android coding, so I am not much help here. I have been trying to figure out how to do these, with out success.

Cheers
Brad

It’s been a while but I’ve encountered the multi-line input problem. For now I have had to hardcode the case of the return key to just call SDL_StartTextInput(); again. So the on screen keyboard is making little jumps when I press return but this seems to be the only good way to do it.

I’d very much prefer it for the keyboard to stay up until I tell it to stop.

So Android has gotten that recently, see https://hg.libsdl.org/SDL/rev/0f2fb9ec6ad6
Can you add this for iOS as well, pretty please?

I’ve added a bugreport + patch at https://bugzilla.libsdl.org/show_bug.cgi?id=4004
BUT it would probably make sense to merge the iOS hint in my patch with the Android IME hint. But the defaults are different.

It is very common in game configurations to find input boxes with only numbers. Is it possible to implement a numeric keypad mode for Android?

Look at the example image:

1 Like