Not sure if it is a bug or intended behaviour but while making a Gui I noticed that if you put a GuiTextField as a child on another GuiElement (tried it with a GuiLabel) and you set its position so that the GuiTextField is outside the other Element (i.e. something like new GuiTextField(1.0f, 1.0f, true, 200f, 30f, false); with setPivot(PivotPosition.TopLeft); thus placing the GuiTextField effectively next to the GuiLabel) then the GuiTextField cannot be clicked and is not editable even if I manually set .setClickable(true); or .setEditable(true);
GuiTextField possible bug when child to other GuiElements
-
- English / German
- Minotorious
- Thread is marked as Resolved.
-
-
I have no idea if it is intended behaviour, but I would not rate this as a bug:
if a GUI control is a child of another but it is outside the parent border, it is perfectly reasonable that it is clipped, if not visually at least as far as events are concerned: do you have a specific reason not to construct the GuiTextField as a sibling of its label rather than its child?
-
have no idea if it is intended behaviour, but I would not rate this as a bug:
I had no idea either that is why I labeled it as a possible bug
do you have a specific reason not to construct the GuiTextField as a sibling of its label rather than its child?
Can I do that with the API? I don't see a .addSibling() method My experience with Guis is null so I am learning as I go with them
-
Can I do that with the API? I don't see a .addSibling() method My experience with Guis is null so I am learning as I go with them
Well, I meant "sibling" in the usual meaning : just make them both (the GuiLabeL and the GuiTextElement) children of the same parent (presumably, but not necessarily, a GuiPanel) with same Y coord and opportunely chosen X coord.(Note: actually using the same Y coord is not the optimum: I found that if I want their texts on the same base line, I have to set Y coord of the GuiTextElement 4 pixels more than the Y coord of the GuiLabel, as the former has some additional height)
-
Well, I meant "sibling" in the usual meaning : just make them both (the GuiLabeL and the GuiTextElement) children of the same parent (presumably, but not necessarily, a GuiPanel) with same Y coord and opportunely chosen X coord.
oh I see yeah that is what I did in the end
-
Actually this is indeed intended behaviour, as @Miwarre suspected, or more precisely, it's a design limitation When the game checks what gui element the mouse is over, it iterates through all elements and its children. It checks if the cursor is within the boundaries of the element, and if it's outside, the game does not perform this check for the child elements.
Participate now!
Don’t have an account yet? Create a new account now and be part of our community!