mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-21 02:58:08 +08:00
Fix on_change() not called for Toggle.
Fix bug 35 and add some tests for the toggle component. Bug:https://github.com/ArthurSonzogni/FTXUI/issues/35
This commit is contained in:

committed by
Arthur Sonzogni

parent
8f87fc96ac
commit
a4d72c4d50
@@ -39,6 +39,10 @@ bool Toggle::OnEvent(Event event) {
|
||||
selected = (selected + entries.size() - 1) % entries.size();
|
||||
|
||||
selected = std::max(0, std::min(int(entries.size()) - 1, selected));
|
||||
|
||||
if (old_selected != selected)
|
||||
on_change();
|
||||
|
||||
return old_selected != selected;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user