My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 7: Pressing Tab key does not focus child widgets in ModalDialog
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  mat.gessel
Type-Enhancement
Priority-Low


Sign in to add a comment
 
Reported by daniel.florey, May 09, 2007
GWT version: 1.3.3
GWT Tk version: 0.2.2
Browsers tested: IE 6, hosted mode
Browsers affected: ?

I've implemented a LoginDialog using the great GWT Tk lib. Unfortunately 
my login input fields focus cycle seems to be broken - the tab key is not 
working inside the dialog. I tested the focus in the multiple-dialog demo 
to doublecheck if this is a general issue but (after a first try that 
didn't work for some reason) it worked perfect.
Is there something obvious that I'm missing?
Comment 1 by daniel.florey, May 09, 2007
Uuup, I'm quite new to this issue tracking tool, so I not even entered a headline :-(
Please forgive me.
Comment 2 by mat.gessel, May 09, 2007
Are you adding a panel containing focusable widgets to the ModalDialog? The current
impl does not scan panels for focusable children. You have to manually add the
panel's children to the focus model (see example below). Please comment if you feel
it should work differently. 

final Button focusManagementDialog = new Button("Focus management");
focusManagementDialog.addClickListener(new ClickListener()
{
  public void onClick(Widget sender)
  {
    final ModalDialog dialog = new ModalDialog();
    dialog.setCaption("Register", false);
    FocusModel fModel = dialog.getFocusModel();
    
    final int FIELD_COUNT = 3;
    Grid table = new Grid(FIELD_COUNT, 2);
    dialog.add(table);
    Widget[] labels = new Widget[FIELD_COUNT];
    labels[0] = new Label("User name: ");
    labels[1] = new Label("Password: ");
    labels[2] = new Label("Retype password: ");
    
    FocusWidget[] fields = new FocusWidget[FIELD_COUNT];
    fields[0] = new TextBox();
    fields[1] = new PasswordTextBox();
    fields[2] = new PasswordTextBox();
    
    CellFormatter formatter = table.getCellFormatter();
    for (int i = 0; i < labels.length; i++)
    {
      table.setWidget(i, 0, labels[i]);
      formatter.setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_LEFT);
      table.setWidget(i, 1, fields[i]);
      fModel.add(fields[i]);
    }
    fModel.setFocusWidget(fields[0]);
    
    ColumnPanel buttonPanel = new ColumnPanel();
    buttonPanel.setWidth("100%");
    dialog.add(buttonPanel);
    
    Button closeButton = new CloseButton(dialog, "Register!");
    fModel.add(closeButton);
    buttonPanel.add(closeButton);
    
    Button cancelButton = new CloseButton(dialog, "Cancel");
    fModel.add(cancelButton);
    buttonPanel.addWidget(cancelButton, false);
    buttonPanel.setCellHorizontalAlignment(ColumnPanel.ALIGN_RIGHT);
    
    dialog.show(focusManagementDialog);
  }
});
panel.add(focusManagementDialog);

Summary: Pressing Tab key does not focus child widgets in ModalDialog
Owner: mat.gessel
Labels: -Type-Defect -Priority-Medium Type-Enhancement Priority-Low
Sign in to add a comment

Hosted by Google Code