4
$\begingroup$

How can I select elements of a list of strings {"a", "b", "c"} using Manipulate, such that when a checkbox is unchecked, only the other elements are presented?

    Manipulate[ 
     {"a", "b", "c"}, 
     Control[{"a", {True, False}}],
     Control[{"b", {True, False}}],
     Control[{"c", {True, False}}]
    ]
$\endgroup$
1

1 Answer 1

5
$\begingroup$

Using a custom function to specify a CheckboxBar in the Manipulate, you can do the following:

list = {"a", "b", "c"};
Manipulate[selected, {{selected, {}}, CheckboxBar[#, list] &}]

You can still change the initial value like with other control specifications by replacing the {} with {"a"} or list or such.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.