The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I am working on a basic menu system and need a way to type in data. I have managed to make the textedits appear in the proper size and location, but they cannot be selected. I know it is displaying text correctly because I preset it with random text which shows.


for key in TheMap.keys():
    var lb = lbScene.instance()#create a label scene
    lb.text = key
    m.add_child(lb) #add to menu
    lb.rect_position[0] = (x/width) * i
    lb.rect_position[1] = 60 * p
    var tb = tbScene.instance()
    m.add_child(tb) # add to menu
    tb.rect_position[1] = (50 * p) + 24 # set y pos
    tb.rect_position[0] = (x/width) * i # set x pos
    i = i+1
    tb.text = ('fwjg;jbw;gbo')
    if (i >= width):
        i = 0
        p = p+1 #new row

If it helps at all, the textedits were selectable when I was using nested VBoxContainers and HBoxContainers for positioning, however they were always the minimum thickness no matter what I did. Any help is appreciated.

in Engine by (14 points)

1 Answer

0 votes

First, check if your TextEdits are actually editable by checking the readonly property. Make sure it is false.

Next, make sure your clicks are reaching the TextEdit. To test that, play your game, and try to click on the TextEdit. If it doesn't work, have a look in the debugger, the "Misc" tab: in this tab you can see which control you clicked last. For example, if the click ended up on a control which has no visuals (such as a container or a plain Control), make sure its mouse mode is set to Ignore, or get rid of it.

Note about containers: if you use VBoxContainer or HBoxContainer, the key to layout items inside them is to either give them a minimum_size, or check the expand flag in Size Flags (vertical or horizontal depending on the case) so the control will fill the area calculated by its container.

by (29,360 points)

Thanks for the tip on VBoxContainer and HBoxContainer.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.