I am making a phonenumber-canvasitem with a country dropdown., see attached screenshot. It is now working as i want, except for one thing - Focus.
I have two problems:
1. When editing or creating new, this item is the first item in the form, and thus gets focus. I want the textitem to get focus, but no matter what i do, the dropdown gets focus. I have tried setCanFocus, selectOnFocus, overriding FocusInItem etc. Nothing works.
2. When it has focus, my dropdown shows no border or focus indication at all. It does per default, but if i call setShowPickerIcon(false) not only the picker icon disapperas (which i want), but all focus indicators vanish as well. Is this really intended bevavior?
I would really appreciate some help on what i can do in order for the focus process to skip my country dropdown and/or how to make the selectitem to show focus.
my code below for my country dropdown:
I have two problems:
1. When editing or creating new, this item is the first item in the form, and thus gets focus. I want the textitem to get focus, but no matter what i do, the dropdown gets focus. I have tried setCanFocus, selectOnFocus, overriding FocusInItem etc. Nothing works.
2. When it has focus, my dropdown shows no border or focus indication at all. It does per default, but if i call setShowPickerIcon(false) not only the picker icon disapperas (which i want), but all focus indicators vanish as well. Is this really intended bevavior?
I would really appreciate some help on what i can do in order for the focus process to skip my country dropdown and/or how to make the selectitem to show focus.
my code below for my country dropdown:
Code:
public class CountryCombobox extends SelectItem { public CountryCombobox() { setImageURLPrefix("flags/"); setImageURLSuffix(".png"); setValueIcons(CountryConstants.getIconMap()); setAlign(Alignment.LEFT); //setValueMap(CountryConstants.getCountryMap()); setDefaultToFirstOption(true); setValueIconWidth(15); setValueIconHeight(15); setShowTitle(false); setCanEdit(true); setAddUnknownValues(false); setCanSelectText(false); //setShowValueIconOnly(true); setShowFocusedIcons(true); setShowFocused(true); setShowPickerIcon(false); setCanFocus(false); ///IGNORED setSelectOnFocus(false);//IGNORED setWidth(60); setAutoFetchData(true); setOptionDataSource(CountryDatasource.getInstance()); setValueField("id"); setDisplayField("code"); ListGridField countryCodeField = new ListGridField("id", "Flag"); countryCodeField.setShowTitle(false); countryCodeField.setAlign(Alignment.CENTER); countryCodeField.setType(ListGridFieldType.IMAGE); countryCodeField.setImageHeight(15); countryCodeField.setImageWidth(15); ListGridField nameField = new ListGridField("name", null); nameField.setShowTitle(false); setPickListFields(countryCodeField, nameField); setPickListHeaderHeight(0); setPickListWidth(150); setPickListHeight(150); } public void setCountryFromMsisdn(String msisdn){ setValue(CountryEnum.fromMsisdn(msisdn).getIso()); } }