Odd TextField issue

I’m more than likely using this the wrong way, but when resetting a TextField element then setting tab focus the cursor is not reset to the start. The field is empty, so I’m thinking a control is not getting updated.

Example Code (using Version: 0.4.6.1008):

[java]
import com.jme3.app.SimpleApplication;
import com.jme3.input.event.KeyInputEvent;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.math.Vector2f;
import com.jme3.system.AppSettings;
import tonegod.gui.controls.buttons.ButtonAdapter;
import tonegod.gui.controls.form.Form;
import tonegod.gui.controls.text.TextField;
import tonegod.gui.core.Screen;

public class TestNewGui extends SimpleApplication
{
public static void main(String[] args)
{
AppSettings settings = new AppSettings(true);
settings.setHeight(600);
settings.setWidth(800);

    TestNewGui app = new TestNewGui();
    app.setShowSettings(false);
    app.setPauseOnLostFocus(false);
    app.setSettings(settings);
    app.start();
}

@Override
public void simpleInitApp()
{
    // disable the fly cam
    flyCam.setEnabled(false);

    inputManager.setCursorVisible(true);

    //create screen control
    Screen screen = new Screen(this);

    //create form control
    Form myForm = new Form(screen);

    //build text field
    final TextField userText = new TextField(screen, "userText", new Vector2f(100, 100), new Vector2f(300, 30))
    {
        @Override
        public void controlKeyPressHook(KeyInputEvent evt, String text)
        {
        }
    };
    userText.setFontSize(26);
    userText.setText("");

    //add field to controls
    myForm.addFormElement(userText);
    screen.addElement(userText);

    //make button to test reset
    ButtonAdapter resetButton = new ButtonAdapter(screen, "quitButton", new Vector2f(100, 140), new Vector2f(50, 30))
    {
        @Override
        public void onButtonMouseLeftDown(MouseButtonEvent event, boolean toggled)
        {
            //do action on button click
            userText.setText("");
            screen.setTabFocusElement(userText);
        }
    };
    resetButton.setFontSize(26f);
    resetButton.setText("Reset");

    //add to conrols
    screen.addElement(resetButton);

    //add screen to the node list
    guiNode.addControl(screen);

    screen.setTabFocusElement(userText);
}

}
[/java]

I just recently noticed this as well. It only seems to happen when setting the focus via code. As soon as I figure out what the cause I’ll post a fix to repo!

And thanks for taking the time to post this.

The issue seems to be that the shader isn’t getting updated properly when the textfield is reset. I should have this fixed soon.