JFXtras / jfxtras

A supporting library for JavaFX, containing helper classes, extended layouts, controls and other interesting widgets.
http://jfxtras.org
Other
599 stars 123 forks source link

TextField tooltip cannot be removed #79

Closed Maxoudela closed 7 years ago

Maxoudela commented 7 years ago

Hi,

In the code, we currently have that :

if (getSkinnable().getTooltip() == null)
        {
            // TODO: internationalize the tooltip
            getSkinnable().setTooltip(new Tooltip("Type a date or use # for today, or +/-<number>[d|w|m|y] for delta's (for example: -3m for minus 3 months)\nUse cursor up and down plus optional shift (week), ctrl (month) or alt (year) for quick keyboard changes."));
        }

I want to display a CalendarTextField where no tooltip is displayed on the TextField. Currently, if I do not set any tooltip, the one above will be set. If I set an empty Tooltip, an empty tooltip will be shown..

We should find a way to allow the user to completely remove the tooltip if he wants to. Currently I do not see a clear solution..

tbee commented 7 years ago

I'm not sure where this code is (man you're doing a lot :-) ), but if it were to be set in the constructor as the default text, then it can be overridden as needed.

Maxoudela commented 7 years ago

It's situated in the createNodes method of the CalendarTextFieldSkin.

It's in the constructor of the CalendarTextFieldSKin so I don't see how I could override that..?

I'm going through an intense session of Calendar tweak, thus all the enhancements^^

tbee commented 7 years ago

So if it is in the createNodes, then it will only be executed upon construction and you should be able to overwrite once the control is created?

Maxoudela commented 7 years ago

Yes indeed you're right! I don't know why I haven't seen that solution before.. Thanks, we can close ;)

Maxoudela commented 7 years ago

Also on a side note, we have a ColumnConstraints in CalendarTextFieldSKin defined that way : ColumnConstraints column0 = new ColumnConstraints(100, 10, Double.MAX_VALUE);

Which means we want a minimum width of 100 and a prefWidth of 10... Shouldn't the two values be reversed?

tbee commented 7 years ago

minimum width of 10 is also weird, so 100,100,max seems more logical?

Maxoudela commented 7 years ago

Well I have the case where I do put the CalendarTextField in very tiny space. 10 is a bit extreme but 100 minimum is too much IMHO. I know that it's weird not to display all the date in the TextField, but it's much more weird when the CalendarTextField is going of bounds because the space you want it to be is to tight. In that situation, we can't even see what we're typing..

tbee commented 7 years ago

Then I'll say: make it so :-)

Maxoudela commented 7 years ago

Allright it's included in the Pull request :)

tbee commented 7 years ago

I've added some additional checking on if parse errors are thrown correctly. I hated the stack traces in the console.