mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-03 21:18:15 +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:
		@@ -39,7 +39,14 @@ class CatchEventBase : public ComponentBase {
 | 
			
		||||
/// auto renderer = Renderer([] {
 | 
			
		||||
///   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,
 | 
			
		||||
                     std::function<bool(Event event)> on_event) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user