mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 18:59:59 +08:00
component/catch_event: improve the example for CatchEvent() (#351)
before this change, the example in the doxygen document for CatchEvent() does not use the documented function. hence the example is not that useful for developers interested in a typical usage of this function. after this change, the example is improved to added the call to CatchEvent(), which allows the application to the Loop() function at user input. Signed-off-by: Kefu Chai <tchaikov@gmail.com>
This commit is contained in:
parent
9dbc23a7d4
commit
a254e36632
@ -39,7 +39,14 @@ class CatchEventBase : public ComponentBase {
|
|||||||
/// auto renderer = Renderer([] {
|
/// auto renderer = Renderer([] {
|
||||||
/// return text("My interface");
|
/// return text("My interface");
|
||||||
/// });
|
/// });
|
||||||
/// screen.Loop(renderer);
|
/// auto component = CatchEvent(renderer, [&](Event event) {
|
||||||
|
/// if (event == Event::Character('q')) {
|
||||||
|
/// screen.ExitLoopClosure()();
|
||||||
|
/// return true;
|
||||||
|
/// }
|
||||||
|
/// return false;
|
||||||
|
/// });
|
||||||
|
/// screen.Loop(component);
|
||||||
/// ```
|
/// ```
|
||||||
Component CatchEvent(Component child,
|
Component CatchEvent(Component child,
|
||||||
std::function<bool(Event event)> on_event) {
|
std::function<bool(Event event)> on_event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user