ArthurSonzogni / FTXUI

:computer: C++ Functional Terminal User Interface. :heart:
MIT License
7.02k stars 428 forks source link

Custom event question #813

Open TsVan1 opened 10 months ago

TsVan1 commented 10 months ago

Are events fixed in ftxui, how to add a custom event, and a callback function for custom events?

ArthurSonzogni commented 10 months ago

You can create custom event like this:

ScreenInteractive::Active()->Post(Event::Special("My custom event"));

It will be stored in a FIFO queue, and dispatched to the component.

If you want to post a task, you can use:

ScreenInteractive::Active()->Post(callback)

Similarly, it will be stored in the same FIFO queue, and executed at some point.

TsVan1 commented 10 months ago

Thank you for your answer, my problem has been solved perfectly, and it is suggested that the complete mt/mtd/md/mdd version of lib file should be added to the release package of windows version. during the test, I found that the lib file provided only supports mdd. If you want to use another version, you need to compile it yourself. of course, if someone who is familiar with it can quickly find the problem and compile it himself, it may take a long time for someone like me to solve the problem.