Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

4.1 toolstripbutton setshowfocused/canfocus bug

$
0
0
Here's what happens.

I expect the following from the code below:
1. i hover over the first button, it goes to "buttonover" state.
2. i click it, it becomes disabled
3. i move mouse pointer to second button, click it. The first button then becomes enabled and is in the "normal state".

However, if i set EITHER setshowfocused or setcanfocus on the button, it will have the "buttonover" state when it goes back into the enabled state, even though my pointer is not above the second button since i just clicked on it.

Surely this is a bug? Would be great if it could be fixed.

Working example snippet:

Code:

mainLayout = new VLayout();

        final ToolStripButton button = new ToolStripButton("Disable");
        button.setShowFocused(false); //CAUSES STRANGE BEHAVIOR
        button.setCanFocus(false); //CAUSES STRANGE BEHAVIOR

        button.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                button.disable();
            }
        });
        ToolStrip toolStrip = new ToolStrip();
        toolStrip.addMember(button);

        final IButton button2 = new IButton("reenable");
        button2.setTitle("Do the thing");

        button2.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent clickEvent) {
                button.enable();
            }
        });

        mainLayout.addMember(toolStrip);
        mainLayout.addMember(new Label("Clicking the first button disables it. Clicking the second button enabled the first button again."));
        mainLayout.addMember(button2);

        return mainLayout;


Viewing all articles
Browse latest Browse all 4756

Trending Articles