• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

iOS keyboard_string & iOS

Status
Not open for further replies.
C

Clinton Wheeler

Guest
Hi,

Im developing an app for iOS that uses the keyboard_string to input text into text fields, this works beautifully in Windows/Mac OS but if i port it to iOS (iPAD) for some reason you cannot reset the keyboard_string to "".

Currently my code will take a string entered from the keyboard_string then process it through another variable and reset the keyboard string:

Code:
if keyboard_string <> ""
{
     var __add = keyboard_string;
     keyboard_string = "";
     add_to_text = true;
}
In iOS the keyboard_string does not reset to "" and this leads to the keyboard_string being added each time from what it previously was and exponentially adds to the text box with every key stroke.

Has anyone had this problem before?

Thanks!

EDIT: Bug has been reported and yoyo are looking at it, link to bug is here: https://bugs.yoyogames.com/view.php?id=31650
 
Last edited by a moderator:

Nocturne

Friendly Tyrant
Forum Staff
Admin
I've not seen this before, but it sounds like a bug and as such I'd report it to YYG. You can do this from the "Help" menu in GMS. Please also supply a download link to a YYZ of the project that shows the issue.
 

rIKmAN

Member
Sounds like the opposite to this bug from way back: https://forum.yoyogames.com/index.php?threads/keyboard_string-refreshes-every-step.51373/

Just tested this and can confirm keyboard_string doesn't reset on iOS, and keyboard_lastchar and keyboard_lastkey also don't appear to work as intended as _lastchar repeats infintely even when cleared and put inside a _lastkey logic check (as per the code example in the manual).

On Android keyboard_string seems to work correctly, but keyboard_lastkey and keyboard_lastchar show the same behaviour as on iOS.

OP could you post the link to the bug report in this thread when you get a response please?

edit:
Seems like the _lastchar bug is already logged, appears it's read-only when using the virtual keyboard on mobile.
 
Last edited:

RyanC

Member
Does anyone know if this has been fixed yet, I couldn't see anything in the release notes.

It seems almost impossible to use the virtual keyboard on iOS because keyboard_string does not reset and also return_key does not work.

GMS: v2.3.2.426
 

RyanC

Member
Sounds like the opposite to this bug from way back: https://forum.yoyogames.com/index.php?threads/keyboard_string-refreshes-every-step.51373/

Just tested this and can confirm keyboard_string doesn't reset on iOS, and keyboard_lastchar and keyboard_lastkey also don't appear to work as intended as _lastchar repeats infintely even when cleared and put inside a _lastkey logic check (as per the code example in the manual).

On Android keyboard_string seems to work correctly, but keyboard_lastkey and keyboard_lastchar show the same behaviour as on iOS.

OP could you post the link to the bug report in this thread when you get a response please?

edit:
Seems like the _lastchar bug is already logged, appears it's read-only when using the virtual keyboard on mobile.
I can't believe after this long it has not been fixed yet.

Does anyone have a good workaround?
 

RyanC

Member
The problem was I was using code from the old GMS manual:

if keyboard_virtual_status() == false
keyboard_virtual_show()

This meant the string would not clear when clicking on another text box while the virtual keyboard is still showing..

Now I am just using keyboard_virtual_show() when clicking on a text box it seems to be fine.

You cannot rely on keyboard_virtual_status() becuase if the user minimises the app and re-opens then keyboard_virtual_status() is still true but with no keyboard showing which is why the old code would not re-open it.

I fixed the returnkey issue with this:

GML:
// in Create Event and when calling keyboard_virtual_show()
enable_return = 0
return_pressed = 0
           
// in End Step
if os_type == os_ios
{
    if keyboard_key == 10
    {
        if enable_return
        {
            enable_return = 0
            return_pressed = 1
        }
    }
    else
    enable_return = 1
}
 

Roldy

Member
The problem was I was using code from the old GMS manual:

if keyboard_virtual_status() == false
keyboard_virtual_show()

This meant the string would not clear when clicking on another text box while the virtual keyboard is still showing..

Now I am just using keyboard_virtual_show() when clicking on a text box it seems to be fine.

You cannot rely on keyboard_virtual_status() becuase if the user minimises the app and re-opens then keyboard_virtual_status() is still true but with no keyboard showing which is why the old code would not re-open it.

I fixed the returnkey issue with this:

GML:
// in Create Event and when calling keyboard_virtual_show()
enable_return = 0
return_pressed = 0
      
// in End Step
if os_type == os_ios
{
    if keyboard_key == 10
    {
        if enable_return
        {
            enable_return = 0
            return_pressed = 1
        }
    }
    else
    enable_return = 1
}
10 is the code for a Line Feed (LF). Windows typically ends lines with a CR/LF while everyone else ends with just an LF. Its been a while since I did anything with iOS but If I recall you can change the iOS return button when invoking the keyboard; between return, submit, done etc.. and I believe those may change the code value as well.

Report this to YYG and see if they can address this internally; either making the iOS virtual keyboard send a CR (vk_enter) or exposing the interface to let the user decide what the keyboard displays/sends for the return/done/enter key on the virtual keyboard.

I would think if you were reading the values straight from keyboard_string then LF would be correct and should be what you get on a non windows platform. However, the keyboard_key value should represent the vk_* codes in a usable way.
 
Last edited:

Nocturne

Friendly Tyrant
Forum Staff
Admin
The link is broken. ¿Can you check the URL, please?
This is originally from 2020... so almost 3 years ago now! I would suggest that if it's still happening you create a test project and file a bug report. I'm going to close this topic for now, as I don't like seeing such old topics constantly bumped, and it's better that you make new topics for anything over 6 months old..
 
Status
Not open for further replies.
Top