Hide CellList on selection of cell

23 views
Skip to first unread message

Piro

unread,
Jun 17, 2011, 4:15:14 AM6/17/11
to Google Web Toolkit
Hi all, i use cell list to select one of customers, and at selection
(through SelectionChangeEvent.Handler ) i hide this list.
Problem is that on selection cell receives focus, but list is hidden
and exception is thrown:

com.google.gwt.core.client.JavaScriptException: (Error): Can't move
focus to the control because it is invisible, not enabled, or of a
type that does not accept the focus

It cause no problems in application, i just want to get rid of
exception. Is there any solution?

Thomas Broyer

unread,
Jun 17, 2011, 5:04:50 AM6/17/11
to google-we...@googlegroups.com
How about slightly delaying the moment when you hide the list? Scheduler.get().scheduleDeferred(...) ?

Piro

unread,
Jun 20, 2011, 5:04:31 AM6/20/11
to Google Web Toolkit
Scheduled command didn't work as expected (It still throws exception
when hiding in deffered command). So i put deffered command in
deffered command, and it works! Here is program i created:

private final ScheduledCommand hideCommand2 = new ScheduledCommand() {

@Override
public void execute() {
setVisible(false);
}
};

private final ScheduledCommand hideCommand = new ScheduledCommand() {

@Override
public void execute() {
Scheduler.get().scheduleDeferred(hideCommand2);//WORK

//doesn't work setVisible(false);
}
};

private final SelectionChangeEvent.Handler selectionHandler = new
Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {
Customer c = selectionModel.getSelectedObject();
if (c == null) {
return;
}
customerEditor.setCustomer(c);
Scheduler.get().scheduleDeferred(hideCommand);
}
};
Reply all
Reply to author
Forward
0 new messages