Announcement

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

    ToolStripButton RADIO button state doesn't work with browser Back button and History

    1. SmartClient Version: v9.1p_2014-11-02/Pro Deployment (built 2014-11-02)
    2. Chrome

    Hi,

    I have a ToolStrip with buttons in the same RadioGroup, the buttons add "history" items only as action.

    Clicking the buttons the state change and is draw properly. But when the Browser Back button is clicked, the last button selected (clicked) is never redraw to show an unselected state.

    How can I solve this?

    Example:
    Code:
            String initToken = History.getToken();
            if (initToken.length() == 0) {
              History.newItem("tsb1_4Sel");
            }
            VLayout l = new VLayout();
    
            final ToolStrip ts4Sel = new ToolStrip();
            final ToolStripButton tsb1_4Sel = new ToolStripButton("tsb14Sel");
            tsb1_4Sel.setRadioGroup("grp");
            tsb1_4Sel.setRedrawOnStateChange(true);
            tsb1_4Sel.setSelected(true);
            tsb1_4Sel.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event)
                {
                    History.newItem("tsb1_4Sel");
                }});
            final ToolStripButton tsb2_4Sel = new ToolStripButton("tsb24Sel");
            tsb2_4Sel.setRadioGroup("grp");
            tsb2_4Sel.setRedrawOnStateChange(true);
            tsb2_4Sel.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event)
                {
                    History.newItem("tsb2_4Sel");
                }});
            final ToolStripButton tsb3_4Sel = new ToolStripButton("tsb34Sel");
            tsb3_4Sel.setRadioGroup("grp");
            tsb3_4Sel.setRedrawOnStateChange(true);
            tsb3_4Sel.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event)
                {
                    History.newItem("tsb3_4Sel");
                }});
            ts4Sel.addMembers(tsb1_4Sel,tsb2_4Sel,tsb3_4Sel);
            
            l.addMembers(ts4Sel);
            l.show();
            
            History.addValueChangeHandler(new ValueChangeHandler<String>() {
    
                @Override
                public void onValueChange(ValueChangeEvent<String> event)
                {
                    String historyToken = event.getValue();
                    
                    if (historyToken.equals("tsb1_4Sel"))
                        tsb1_4Sel.select();
                    if (historyToken.equals("tsb2_4Sel"))
                        tsb2_4Sel.select();
                    if (historyToken.equals("tsb3_4Sel"))
                        tsb3_4Sel.select();
                }});
            History.fireCurrentHistoryState();
    Test:
    1) Click each button, one after the other, several times. That stores the history and shows it in the URL.
    2) Click the browser back button: the last clicked button is never showed as "unselected".

    Thanks,
Working...
X