ArthurSonzogni / FTXUI

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

on_change event does nothing in Toggle #35

Closed VedantParanjape closed 4 years ago

VedantParanjape commented 4 years ago
Toggle pru_start_top;
...

pru_start_top.on_change = [this] {
    started = pru_start_top.selected;
};

Value of started doesnot change. Does Toggle component have a on_enter event ?

I think issue is in this function definition: https://github.com/ArthurSonzogni/FTXUI/blob/8f87fc96acbea4f89489ef553693e9cbf84f2afe/src/ftxui/component/toggle.cpp#L30

You forgot to call the on_change function in OnEvent function based on type of event received. Is this a mistake or design choice ?

ArthurSonzogni commented 4 years ago

Indeed! This is missing. Thanks for reporting this!