1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-28 07:23:13 -04:00

toggle_value

This commit is contained in:
lucasmerlin
2025-06-30 12:19:05 +02:00
parent fa83d6c14a
commit e8061684b9

View File

@@ -2082,8 +2082,8 @@ impl Ui {
/// Click to toggle to bool.
///
/// See also [`Self::checkbox`].
pub fn toggle_value(&mut self, selected: &mut bool, text: impl Into<WidgetText>) -> Response {
let mut response = self.selectable_label(*selected, text);
pub fn toggle_value<'a>(&mut self, selected: &mut bool, atoms: impl IntoAtoms<'a>) -> Response {
let mut response = self.selectable_label(*selected, atoms);
if response.clicked() {
*selected = !*selected;
response.mark_changed();