Tooltip for disabled controls
java.whoover at gmail.com
Thu Apr 4 08:38:07 PDT 2013
I don't think supporting the use of tooltips on disabled controls is a good design pattern to follow (not to mention the overhead of typically unnecessary event propagation). If the behavior is really desired they can use option #3 or a similar solution using an icon/image with tooltip adjacent to the control.
From: openjfx-dev-bounces at openjdk.java.net [mailto:openjfx-dev-bounces at openjdk.java.net] On Behalf Of Pavel Safrata
Sent: Thursday, April 04, 2013 9:34 AM
To: openjfx-dev at openjdk.java.net
Subject: Tooltip for disabled controls
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.
More information about the openjfx-dev