GuiTextField not clickable?

  • Setting a GuiTextField element as clickable with GuiTextField.setClickable(true) seems to have no effect: clicking on the element does not generate any PlayerGuiElementClickEvent event.


    This is the specific code I am using for the element (it belongs to a sub-class of the GuiPanel class containing several other child elements):


    Code
    text= new GuiTextField(NAMETEXT_XPOS, OWNER_YPOS, false, NAMETEXT_WIDTH, TEXTENTRY_HEIGHT, false);
    text.setPivot(PivotPosition.TopLeft);
    text.setBorderThickness(1, false);
    text.setBackgroundPreset(1);
    text.setClickable(true);
    text.setEditable(false);
    text.setListenForInput(false);
    addChild(text);
    player.addGuiElement(text);

    I tried with various combination of setEditable(false/true) and setListenForInput(false/true) with no difference. The field IS shown and, if set to editable, can be edited and generates PlayerGuiInputEvent, so I presume the code is basically correct.


    The specific use case is to simulate a dropdown / combo list, where the text of the element is not directly editable but clicking on it shows a list to choose from. I can use a work-around using a GuiLabel for the text and a button to show the list, but the visual result is not as clean and evident as it could be.


    Am I overlooking something or there is a bug indeed?

  • Hmm... when setting setEditable() to true the textfield should forward click events to the plugin 8| I tried the code above, as long as setEditable() is set to false, the textfield basically gets disabled (so it does not react to any input - maybe that's something we should change in the future^^), however, when setting it to true, click events are triggered.
    It's strange that it didn't trigger the click events in your case... can you maybe provide a full test-case?

  • Thanks for the reply. I'll check again with all the possible combinations of the three flags involved and, if I find something which does not match your description, I'll provide a full test case.


    About the of setEditable(false) and setClickable(true) combination, I suggest it to be implemented, at least as long as a GuiLabel cannot be (easily?) be made to look like a GuiTextField to show a datum which has been entered (for instance choosing in a list) but not directly editable.


    Possibly it isn't a BIG change?

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!