Skip to content

How to force redraw of screen from within a component #278

Answered by ArthurSonzogni
mscofield0 asked this question in Q&A
Discussion options

You must be logged in to vote

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 event ftxui::Event::Custom.

screen->PostEvent(Event::Custom);
ftxui::ScreenInteractive::PostEvent is thread safe.


Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ArthurSonzogni
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants