Giter VIP home page Giter VIP logo

Comments (12)

Maxoudela avatar Maxoudela commented on September 25, 2024

When you look at normal browser behavior, it's what you see.

I've made a little video in my application showing the issue when the user wants to input a Date into a SpreadsheetView :
https://gfycat.com/SpiritedSmoggyAcornweevil

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Well, if I understand it correctly, it is a JavaFX TextField problem. The date/time textfield reuse the prompt text, so Jonathan should fix it. Would it be of much use if only the date/time textfields would have the correct behavior?

OTOH (I get your point), if we can fix it until the TextField fixed, why not...

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Well at first, we had the behavior in the common browser where the prompt text was seen until something was typed. But this issue came in : https://bugs.openjdk.java.net/browse/JDK-8100686 and said that in Windows, when the focus was in, the prompt text should be gone..

So this is never going to be fixed in JavaFX I believe..

I can directly have the behavior I want in my application by doing the CSS trick, so really, it's whether your want this behavior by default in your textField date/time controls or not.. Thus the "enhancement" tag..

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Well, I think the TextFields should behave as normal textfields do. So my question is: why do you want it differently? As I see it, your problem comes from that there is no textfield visible until the focus is placed. In that scenario you create the textfield AND put the focus in there, so the prompt text is never displayed. This holds for all textfields, so we should find a solution that you can apply to all textfields, like a decorator maybe? Can a TextField know when it is being used in a table?

from jfxtras.

tbee avatar tbee commented on September 25, 2024

But this is something that is an issue for TableView as well, isn't it?

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Yes It's an issue in the TableView because of what you described. As soon as the TextField is shown, the focus is in.

I though this issue would be annoying to other person, if not, we can close this issue and keep the current behavior.

from jfxtras.

tbee avatar tbee commented on September 25, 2024

I think you are right and that your solution is better for a TextField in a TableView. But it is a problem for all TextFields in TableView. I do not think patching just the JFXtras date textfields is the way to go. We need a solution for all textfields.

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Maybe it is possible to create a TableViewPromptTextPatch. Any TextField that is used in a TableView should be added to an instance of that class. The patch class will add the prompt.css (that is a resource to the patch class) to the stylesheets of the TextField and start listen to the text-property, adding or removing the prompt class as needed. In this way you have one solution for all TextFields.

Or even better: we create an extended version of TableView in JFXtras with this functionality build in.

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

Well, this promptText is annoying in the date because we really want to parse the date.
Other Textfields are usually used for double or integer, and I don't put any promptText on them because I do not expect any particular format. Just a number.

I think we could go simpler if we want to patch the TableView (as a side-note, I'm using that in the SpreadsheetView of ControlsFX, not in the TableView right now), by adding in the css this :

TableView .text-field{
    -fx-prompt-text-fill: derive(-fx-control-inner-background, -30%);
}

Each TextField in the tableView will have the prompt text "fixed" I believe.

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Hmmm, you simply need to test. TextField will change things in its CSS in order to hide and show the prompt text, and this should override (negate) the normal behavior. I'm not sure it will.

You could try and convince the spreadsheet guy to 'handle' the textfield. But since you specify which editors to use, the TableViewPromptTextPatch should work. Never the less I'm pretty sure it should not be done as default behavior on CalendarTextField and friends, since it really is a TableView induced problem and should be handled for all textfields.

from jfxtras.

Maxoudela avatar Maxoudela commented on September 25, 2024

I just tested it on the SpreadsheetView by adding

.spreadsheet-cell .text-field{
     -fx-prompt-text-fill: derive(-fx-control-inner-background, -30%);
}

And it works. The Textfield is actually not changing things on the CSS, or at least it is not bothered.

By the way, I'm the "Spreadsheet guy" of ControlsFX^^. I created the SpreadsheetView. I will see what I can do, but on my application, the issue is fixed by simply using css. We can close this issue regarding JFXtras.

from jfxtras.

tbee avatar tbee commented on September 25, 2024

Very good spreadsheet guy. :-)

from jfxtras.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.