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

Reassignment of the key button #591

Closed
MrChebik opened this issue Sep 25, 2017 · 2 comments
Closed

Reassignment of the key button #591

MrChebik opened this issue Sep 25, 2017 · 2 comments

Comments

@MrChebik
Copy link
Contributor

I have an CodeArea, and this event:

this.setOnKeyTyped(event -> {
    if (event.getCharacter().equals("\t")) {
        this.insertText(this.getCaretPosition(), "    ");
        event.consume();
    }
});

I want to change width of tab key, but event.consume() does not work and I get previous \t and four spaces after \t:

|
_______    |
key explanation
I caret
_ width of tab
space my inserted text
@MrChebik MrChebik changed the title Reassignment of the button Reassignment of the key button Sep 25, 2017
@JordanMartinez
Copy link
Contributor

Have you read GenericStyledArea's class' javadoc? I believe it specifies that you aren't supposed to use setOn[Event](handler), but rather the code pattern found in Override Behavior Demo

@MrChebik
Copy link
Contributor Author

Thank you!

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