How to move the screen when the virtual keyboard is show in Android and iOS?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Pelli

Hi I was struggling a lot of hours because my lineedits don´t worked. The virtual keyboard was shown but you weren´t able to input letters on the lineedit. So I realized that was because I was moving the screen like this:
the parent of the scene is Control, so:
Control.position -= 900
I removed that line of code that was executed when the lineedit was focused and now it´s working again, but my keyboard is overlamping some part of the game that I need to show, so How I can move the screen up?

:bust_in_silhouette: Reply From: Wakatta

After moving your screen using control.position.y -=900 grab focus with your line edit my_line_edit.grab_focus()

I think is the same that what I am doing, I am connecting the signal focus entered and then
Control.position -= 900 and that break all

Pelli | 2021-03-19 05:09

Hmm well position is supposed to be a Vector2(xpos, ypos)
Xpos being left-right and Ypos being up-down
So something like Control.position -= Vector2 (0, 900) should do the trick
Also gonna go out on a limb here and assume by Control you mean the node reference to control and not that your code actually has Control.position -= 900

If it does you can get the main scene by using get_tree().get_current_scene()

Wakatta | 2021-03-20 02:11