Skip to content

EFFECT_DEACTIVATE runs on a disabled Button #125

@codewalkerdan

Description

@codewalkerdan

When writing a custom effect for buttons. I noticed that when a button is disabled if you hover and leave the disabled button the EFFECT_DEACTIVATE effect runs regardless. This is more evident using custom styles and effects.

Checking on the Button source code I noticed that the the check if the button is disabled is commented

    @Override
    public void mouseExited( MouseMotionEvent event, Spatial target, Spatial capture ) {
        //if( !isEnabled() )
        //    return;
        if( !isHighlightOn() ) {
            // If the highlight is on then we need to run through
            // the events regardless of enabled state... and if it's 
            // not on then there is no reason to run events. 
        }
        showHighlight(false);
        commandMap.runCommands(ButtonAction.HighlightOff);
        runEffect(EFFECT_DEACTIVATE);
    }

My workaround was to modify my custom disable effect that will check if the button is enabled to execute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions