yes indeed, I was able to reproduce the error by trying to focus a group box (not sure what should be 'focused' on a group box item, but certainly this error should not occur!)! So feel free to open a ticket and report the problem! Maybe we have a common problem when focusing fields where we don't know what to focus (e.g. group boxes & labels, etc.)
Not sure, if I understood your problem correctly, but I suggest (as a workaround), you override requestFocus()
in your group box (e.g. main box), where you collect all child fields that are focusable (and maybe of a special type) recursively, sort them by their order and afterwards get the first available one (if one's available) and set focus to that. Else do nothing.
Could be something like that:
@Override
public void requestFocus() {
final Map<Double, IFormField> orderedFields = new TreeMap<>();
getBoxWithDesiredFocusableFields().visitFields(new IFormFieldVisitor() {
@Override
public boolean visitField(IFormField field, int level, int fieldIndex) {
if (field.isFocusable() && field....some specific conditions) {
orderedFields.put(field.getOrder(), field);
}
return true;
}
}, 0);
if (orderedFields.keySet().iterator().hasNext()) {
// Focusable fields available -> get first focusable field
IFormField firstFocusableField = orderedFields.get(orderedFields.keySet().iterator().next());
if (firstFocusableField != null) {
firstFocusableField.getForm().requestFocus(firstFocusableField);
}
}
}
Best regards,
Mattthias