Skip to main content

TextField and requestFocus

1 reply [Last post]
Joined: 2006-04-20

I'm trying to call requestFocus methode with a TextField. Without success.

Any link to a working case?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-04-20

In fact there is 2 points:

1/ with a Panel instance binded to his Frame ancestor before this one is visible: set "visible" at true is not enough. To call "show" is [b]also[/b] needed.

var passwordField = PasswordField {
value: bind user.password

main = Frame {
content: bind BorderPanel {...} // passwordField is used here

main.visible = true; // needed to "show" the frame; // needed to get the requestFocus
passwordField.requestFocus(); // Panel ancestor is already visible, see binding above

2/ when a Panel instance is set visible as his Frame ancestor is already visible: the call to requestFocus() by a widget in this panel must be done after this panel is binded to his Frame ancestor.