I'm new to ReactFX and I'm trying to capture the CTRL and C keys being pressed for a typical copy operation.
How do I capture this effectively into a stream? This is all I could get so far but it is not even compiling...
final EventStream<KeyEvent> keysTyped = EventStreams.eventsOf(myTbl, KeyEvent.KEY_TYPED)
.reduceSuccessions((a,b) -> new KeyCodeCombination(a.getCode(),b.getCode()), 500);
This works for me:
KeyCombination ctrlC = new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN);
final EventStream<KeyEvent> keysTyped = EventStreams.eventsOf(text, KeyEvent.KEY_PRESSED)
// the following line, if uncommented, will limit the frequency
// of processing ctrl-C to not more than once every 0.5 seconds
// As a side-effect, processing will be delayed by the same amount
// .reduceSuccessions((a, b) -> b, Duration.ofMillis(500))
.filter(ctrlC::match);
keysTyped.subscribe(event -> System.out.println("Ctrl-C pressed!"));