MonoGame.Extended
MonoGame.Extended copied to clipboard
[NuclexGUI] Textbox Cursor in wrong Position
Hey, first off, a huge thank you for developing this very nice library!
I can't seem to get the Nuclex Textbox to render correctly. When it's empty the cursor moves down below its normal position. When there is text, the cursor is in the right position. When the Text is removed the cursor moves back down in the incorrect position.
In the image below you can see the behavior. On the left there is no text and the cursor is in the wrong position (It should be at the same height as on the right). On the right, after I entered some text, the cursor is in the correct position.
Sorry for the crappy image, both parts of the image are from the same textbox. They might look different, but that comes from putting them into the same image.
This is how I added the Textbox to the Screen (gui is GuiManager):
gui.Screen = new GuiScreen(800, 480);
gui.Screen.Desktop.Bounds = new UniRectangle(
new UniScalar(0f, 0),
new UniScalar(0f, 0),
new UniScalar(1f, 0),
new UniScalar(1f, 0)
);
gui.Initialize();
var textbox = new GuiInputControl
{
Name = "textbox",
Bounds = new UniRectangle(
new UniScalar(0.0f, 20),
new UniScalar(0.0f, 20),
new UniScalar(0f, 120),
new UniScalar(0f, 30)),
};
gui.Screen.Desktop.Children.Add(textbox);
My guess is that when it's measuring the size of the empty text it's returning Size.Empty
or something.
Instead of doing that it should return new Size(0, font.LineHeight)
.