Cyril
Cyril

Reputation: 13

How to remove backward (Ctrl+H) functionality from TextField?

I have an application which has menubar.
This menubar has a menuitem with the Ctrl+H accelerator.
The problem is that when a TextField (or PasswordField) is focused, it catch the Ctrl+H event to make a backward deletion.

Does someone have a trick to prevent the textfield from catching this event?

Upvotes: 0

Views: 325

Answers (1)

Yogesh Soni
Yogesh Soni

Reputation: 272

try this code....it will prevent TextBox from backward remove(Ctrl+H).

   txtBox.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
    @Override
    public void handle(KeyEvent t) {           
            if(t.getCode()==KeyCode.H && t.isControlDown() )
            {                                                

               t.consume();
            }                           
    }});

Upvotes: 1

Related Questions