Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RadioGroupItem setGlobalTabIndex not working properly in sequense

    When I use setGlobalTabIndex() on RadioGroupItem in DynamicForm, it doesn't work in sequence, it always gets focus on after the last element.

    I am using Smart GWT 13.0 LGPL Edition

    Here is a sample code:

    Code:
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.ColorPickerItem;
    import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
    import com.smartgwt.client.widgets.form.fields.SliderItem;
    import com.smartgwt.client.widgets.form.fields.SpinnerItem;
    import com.smartgwt.client.widgets.form.fields.TextAreaItem;
    import com.smartgwt.client.widgets.form.fields.TextItem;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class RadioTabExample implements EntryPoint {
    
        public void onModuleLoad() {
            VLayout layout = new VLayout(10);
    
            final DynamicForm form = new DynamicForm();
            form.setWidth(620);
            form.setColWidths(190, "*");
    
            TextItem textItem = new TextItem();
            textItem.setTitle("Text");
            textItem.setGlobalTabIndex(1);
            textItem.setHint("<nobr>A plain text field</nobr>");
    
            TextAreaItem textAreaItem = new TextAreaItem();
            textAreaItem.setTitle("TextArea");
            textAreaItem.setGlobalTabIndex(2);
    
            ColorPickerItem colorPicker = new ColorPickerItem();
            colorPicker.setTitle("Color Picker");
            colorPicker.setGlobalTabIndex(3);
    
            RadioGroupItem radioGroupItem = new RadioGroupItem();
            radioGroupItem.setTitle("Radio Group");
            radioGroupItem.setValueMap("Option 1", "Option 2");
            radioGroupItem.setGlobalTabIndex(4);
    
            SpinnerItem stackedSpinnerItem = new SpinnerItem();
            stackedSpinnerItem.setTitle("Stacked Spinner");
            stackedSpinnerItem.setDefaultValue(5);
            stackedSpinnerItem.setMin(0);
            stackedSpinnerItem.setMax(10);
            stackedSpinnerItem.setStep(0.5f);
            stackedSpinnerItem.setWriteStackedIcons(true);
            stackedSpinnerItem.setGlobalTabIndex(5);
    
            SpinnerItem unstackedSpinnerItem = new SpinnerItem();
            unstackedSpinnerItem.setTitle("Unstacked Spinner");
            unstackedSpinnerItem.setDefaultValue(5);
            unstackedSpinnerItem.setMin(0);
            unstackedSpinnerItem.setMax(10);
            unstackedSpinnerItem.setStep(0.5f);
            unstackedSpinnerItem.setWriteStackedIcons(false);
            unstackedSpinnerItem.setGlobalTabIndex(6);
    
            SliderItem sliderItem = new SliderItem();
            sliderItem.setTitle("Slider");
            sliderItem.setHeight(40);
            sliderItem.setMinValue(1.0);
            sliderItem.setMaxValue(5.0);
            sliderItem.setNumValues(5);
            sliderItem.setDefaultValue(4);
            sliderItem.setGlobalTabIndex(7);
    
            form.setFields(textItem, textAreaItem, colorPicker, stackedSpinnerItem, radioGroupItem, unstackedSpinnerItem,
                    sliderItem);
            layout.addMember(form);
    
            layout.draw();
        }
    
    }
    RadioGroupItem tab index is 4, but it always gets focus at the last. It should get focus after ColorPickerItem when press tab, but it's not,

    Thank you

    #2
    Why are you trying to manually set global tab indexes? As the docs mention, this is extremely advanced, and it would be very rare that there would be a legitimate reason to do it.

    If you just delete your attempts to manage tab indexes, you'll find that everything works perfectly.

    Comment

    Working...
    X