radio_buttons
X
00:00
/
00:00
CC
In this screencast we are going to show you
how to make radio button checkboxes. That is,
mutually exclusive checkboxes.
The idea is that we have several objects, but we
only want to see one of them.
For example, we have 3 points here and suppose
our goal is to see only 1 of these points at any
one time.
So for the first thing we do is create 3
checkboxes, each of which is joined to 1 of the
points. So let us make 3 checkboxes. Checkbox.
“Show only A”. And we will choose A from the
list. Another checkbox. “Show only B”. Choose B
from the list.
And now we are going to make a tiny mistake so
we can see how to fix it.
We are going to say “Show only C”. And we are
going to forget to choose C from the list. So we
have done this.
And so this checkbox and this checkbox are
indeed connected to the points. Let us see. A.
Okay. B. Okay.
But C is not connect because we “forgot” to
connect it. So how do we connect it? First thing
we do is check which Boolean. So this is little c.
And C is the object we want to connect, so we
right-click. Go to Object properties. Go to the
Advanced tab and
on “condition to show object” we type little c.
Close. And now that point is connected. Now
these are not mutually exclusive. That is our goal.
In order to connect them, we are going to do a
little tiny bit of scripting. So right-click on the first
Boolean (checkbox). Go to “Object properties”.
Go to Scripting. Click inside on the “On update”
tab. Here is the piece of script. SetValue[a,true],
SetValue[b,false], SetValue[c,false].
What it does is says is say “a” to be true, “b” to
be false, and “c” to be false.
Of course, these need to be the names of your
checkboxes, that is, of your Booleans.Don’t
forget to click on OK.
Click on the next Boolean b. Paste the same script
in except now where “a” is, we write “b” and
where “b” is, we write “a”.
Delete “a”, type “b”. Go down. Delete “b”, type
“a”. Click on OK.
Go to “c”. Paste the same script in. And now in
place of “a”, we type “c” and in place of “c”, we
type “a”.That is it.
Click on OK and then on Close. The checkboxes
are now mutually exclusive.
So now I click on A, and B and C turn off. I click
on B, and A and C turn off. I click on C, and A and
B turn off.
Radio buttons out of checkboxes. That’s it!