this post was submitted on 11 Nov 2025
14 points (100.0% liked)

Godot

7240 readers
7 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

founded 2 years ago
MODERATORS
 

So I am trying to build a simple todo APP for mobile as a learning experience.

I have a lineEdit which activates the virtual keyboard. This goes over the lineEdit.

I read that I should get the keyboard height with displayserver.virtual_keyboard_height() on an focus_entered() signal which is emitted from lineEdit.

When I try to do that, the value is 0. This is because the keyboard appears to slow. I put in a:

await get_tree().create_timer(1).timeout

Which gets the height of the keyboard but building in a 1 second delay can't possibly be the right solution here.

My question is: how did you solve this problem? And is it possible to not bother wit that at all? Is there a option in the project settings that makes it that, when the keyboard appears the whole app gets pushed up?

I don't really grasp how the keyboard interacts with the app. Is it considered an overlay or part of the app?

top 2 comments
sorted by: hot top controversial new old
[โ€“] 4Robato@lemmy.world 3 points 1 month ago* (last edited 1 month ago) (1 children)

I encountered this problem mylsef. The way I solved it was to do a scroll container and then do:

func _scroll_to_text_edit(text_edit : TextEdit) -> void:
 scroll_container.ensure_control_visible(text_edit)

For the height problem you have to do it inside a _process() so it runs in every frame:

func _process(_delta: float) -> void:
 if DisplayServer.has_feature(DisplayServer.FEATURE_VIRTUAL_KEYBOARD):
  var keyboard_height = DisplayServer.virtual_keyboard_get_height()
  if keyboard_height > 0:
   self.size.y = get_viewport_rect().size.y - keyboard_height
  else:
   self.size.y = get_viewport_rect().size.y

You can check my lame implementation here: https://github.com/4Robato/track-your-counters/blob/main/UI/main.gd

It's been a while and I forgot a bit the details and I can't take a deeper look now but I hope this helps!

Thanks for the answer!

I will implement your solution as I don't see a way to get the virtual keyboard to emit a signal when reaching full height.