Tooltip for disabled controls

Pavel Safrata pavel.safrata at oracle.com
Thu Apr 4 06:34:14 PDT 2013


Hello,
we've got a request to support tooltips for disabled controls. Tooltip 
can be used to explain why the control is disabled which sounds 
reasonable. Jira: https://javafx-jira.kenai.com/browse/RT-28850

We have the disableProperty on Node. When a node is disabled, it is not 
picked, so no mouse events are delivered to it, so tooltip can't be 
shown as it is based on mouse events.

Perhaps not delivering events to a disabled node was a bad decision. 
First, there are use-cases where disabled node wants them (showing 
tooltip). Second, for ignoring node during picking we have the 
mouseTransparent flag and it would be nicer if these two flags were 
orthogonal (the reason they're not is probably that mouseTransparent is 
much younger). But the behavior can't be easily changed - controls, and 
possibly other nodes in user apps, rely on the existing behavior.

There are three basic approaches.

1. Make the events delivered to the disabled nodes. We would either 
break backward compatibility (and fix controls), or introduce yet 
another flag, something like pickIfDisabled. Then we would enable 
picking for the disabled control which would make the tooltip work. But 
it would make the entire control work, so we would somehow have to 
disable other event handling for such controls.

2. Don't change event delivery and rather introduce some control-layer 
solution specific to tooltips. Maybe the disabled control registering a 
special tooltip area on its parent or something like that.

3. Do nothing and force users to workarounds like put the disabled 
control into an enabled Pane and set the tooltip on the Pane. Sounds 
horrible, especially for complex applications.

Thoughts? Ideas?

Thanks,
Pavel



More information about the openjfx-dev mailing list