Hi,
thank you very much, these explanations are great.
But it still does not work! :-/
I found that I never explicitely attach the DialogBox to the
RootPanel. Remember, it is of class DialogBox, which appears right
after creating it and calling "center". So I always concluded that the
attachment is done in the background somehow.
If I explicitely attached it to the RootPanel, I would think that this
would then be done twice, because the DialogBox is shown after
"center"...
What I acutally did is to create the deferred command as recommended
(see code below).
What do you think?
Thanks
Magnus
-----
public class LoginBox extends DialogBox
{
private final TextBox txt_User = new TextBox ();
private final PasswordTextBox txt_Password = new PasswordTextBox ();
// "Field" is just a VerticalPanel combining the label with the text
box
private final Field fld_User = new Field ("User",txt_User);
private final Field fld_Password = new Field
("Password",txt_Password);
public LoginBox ()
{
build ();
}
public void build ()
{
setText ("Login");
setGlassEnabled(true);
// arrange the fields using a table ...
PushButton btn = new PushButton ...
}
public void run ()
{
center ();
Scheduler.get().scheduleDeferred
(
new ScheduledCommand()
{
@Override
public void execute()
{
fld_User.setFocus();
txt_User.setFocus(true);
}
}
);
}
}