Skip to main content

TextField and requestFocus

1 reply [Last post]
atao
Offline
Joined: 2006-04-20
Points: 0

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.
atao
Offline
Joined: 2006-04-20
Points: 0

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.

[code]
var passwordField = PasswordField {
value: bind user.password
};

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

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

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.