This is my first day of actual Pivot programming, and I created a login screen that has some TextInput fields. I want the first field to be focused when the form opens, so I did it like this:

public class LoginFrame extends Frame implements Bindable {
    @BXML TextInput hostname;

    public void open(Display display, Window owner) {
        super.open(display, owner);
        hostname.requestFocus();
    }
}

This works, but I'm thinking there must be a smoother way, like setting a property on the TextInput when I declare it in my BXML maybe?

I understand that I cannot request focus for the component in the Bindable#initialize() method, since the component isn't actually displaying at the time of initialization, but maybe there is a way for the framework to sort this out by looking at a property or something when it is first displayed?

-- Edvin

Reply via email to