Help about focusable object cycling #1048
-
|
Hello All, I'm currently trying to make an application for RPG. I've start from file: 'examples/component/focus_cursor.cpp', and my app was working but as soon as I try to make a change, things does not work properly. The only thing I want for now, is just a window with a title ('(1) Infos', and 3 focusable object 'Race', 'Training package' and 'Realm'. Currently all is fine, except that pressing TAB, CTRL-TAB, DownArrow and UpArrow does not change the focus between the 3 elements. Here is the code for the "root window": And here the code for the window containing the 3 labels: And the main loop call: What do I do wrong ? Why I'm not able to go through my 3 "lines" ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @lmarzull, It looks like you are using the The auto inner = [...]
auto renderer = Renderer(inner, [&] {
return inner->Render() | border
});and auto renderer = Renderer([&]{
return text("hello");
})The first create a new Component, adds The Component Tree looks like: The second version doesn't. It create a new Component and doesn't know about I think you should use the first version, because you are trying to customize the inner component. Otherwise, you will fail to properly plug the events in the Component Tree. Your tree is broken. It looks like this currently: but I think you wanted something like: |
Beta Was this translation helpful? Give feedback.
Hi @lmarzull,
It looks like you are using the
Rendererfunction improperly. Maybe you should directly create newComponentBaseobject directly and override theOnRenderfunction instead? That's more boilerplate, but it won't hide you any details.The
Rendererexist in two versions:and
The first create a new Component, adds
inneras a child, and defers all the behavior to the childs, except forOnRenderthat is using the specified function.The Component Tree looks like: