Skip to content

Logs component #400

Answered by ArthurSonzogni
Alexandring asked this question in Q&A
May 18, 2022 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

There are many ways.
Let's say you are going to store the data into:

std::vector<std::string> log;

You can display them inside the Menu component:

int log_index = 0;
auto log_menu = Menu(&log, &log_index)

To make the menu displayed inside a scrollable area, you can use the element decorator: frame. You can also add a scroll indicator using: vscroll_indicator decorator:

auto log_menu_decorated = log_menu | vscroll_indicator | frame;
Alternatively
auto log_menu_decorated = Renderer(log_menu, [log_menu] {
  return log_menu->Render() | vscroll_indicator | frame;
});

That's it.
If you don't want to use Menu, you should be able to build any kind of component rendering the log the way you want…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@ArthurSonzogni
Comment options

@Chasikanaft
Comment options

@ArthurSonzogni
Comment options

@ArthurSonzogni
Comment options

@Chasikanaft
Comment options

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
3 participants