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.
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
My workaround was to modify my custom disable effect that will check if the button is enabled to execute.