How to force redraw of screen from within a component #278
-
I would like to keep my component's logic decoupled, and I was wondering if there was an already built-in way to notify the screen to redraw. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @mscofield0, Yes, you can force a screen redraw, by posting a new events into the event loop. TLDR: screen->PostEvent(Event::Custom); There is a section about this in the documentation: Whenever a new group of events have been processed: keyboard, mouse, window resize, etc..., the You might want to react to arbitrary events that are unknown to FTXUI. This can be achieve by posting events via
|
Beta Was this translation helpful? Give feedback.
Hi @mscofield0,
Yes, you can force a screen redraw, by posting a new events into the event loop.
TLDR:
screen->PostEvent(Event::Custom);
There is a section about this in the documentation:
https://arthursonzogni.github.io/FTXUI
Whenever a new group of events have been processed: keyboard, mouse, window resize, etc..., the
ftxui::ScreenInteractive::Loop()
is responsible for drawing a new frame.You might want to react to arbitrary events that are unknown to FTXUI. This can be achieve by posting events via
ftxui::ScreenInteractive::PostEvent
, via a thread. You can post the eventftxui::Event::Custom
.screen->PostEvent(Event::Custom)
;ftxui::ScreenInteractive::PostEvent
is thread safe.