Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blink-caret-rate CSS Property doesn't work #426

Closed
JordanMartinez opened this issue Jan 17, 2017 · 5 comments
Closed

blink-caret-rate CSS Property doesn't work #426

JordanMartinez opened this issue Jan 17, 2017 · 5 comments

Comments

@JordanMartinez
Copy link
Contributor

Styling this property via CSS does nothing to change the default value of 500ms.

@JordanMartinez
Copy link
Contributor Author

Updating styled-text-area.css to:

.styled-text-area .virtual-flow {
    -fx-cursor: text;
    -fx-caret-blink-rate: 100ms;
    -fx-font-size: 32pt;
}

and this code...

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.fxmisc.flowless.VirtualizedScrollPane;
import org.fxmisc.richtext.StyleClassedTextArea;
import org.fxmisc.richtext.StyledTextArea;

import java.util.Collection;
import java.util.Collections;

public class CssTest extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        StyledTextArea<String, Collection<String>> area = new StyledTextArea<String, Collection<String>>("", (a, b) -> {},
                Collections.emptyList(), (a, b) -> a.getStyleClass().addAll(b));
        area.replaceText("Some text in the area");
        VirtualizedScrollPane<StyledTextArea<String, Collection<String>>> vsPane = new VirtualizedScrollPane<>(area);

        Scene scene = new Scene(vsPane, 500, 500);
        scene.getStylesheets().add(StyleClassedTextArea.class.getResource("styled-text-area.css").toExternalForm());
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}

@JFormDesigner
Copy link
Contributor

@JordanMartinez it works with PR #398 and without .virtual-flow in the CSS selector:

.styled-text-area {
    -fx-caret-blink-rate: 100ms;
}

@JordanMartinez
Copy link
Contributor Author

Thanks! However, why does that inclusion cause this problem in the first place?

@JFormDesigner
Copy link
Contributor

Because -fx-caret-blink-rate and -fx-highlight-fill CSS properties are not defined in VirtualFlow or any of its children. They are defined in class GenericStyledArea, which has CSS class styled-text-area.

JordanMartinez added a commit that referenced this issue Jan 17, 2017
Fix -fx-highlight-fill and -fx-caret-blink-rate (issues #303 & #426)
@JordanMartinez
Copy link
Contributor Author

Good to know.

Closed by #398

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants