# Checkbox switch

**URL:** https://discourse.processing.org/t/checkbox-switch/28334
**Category:** Coding Questions
**Created:** [March 8, 2021, 10:47am UTC](https://discourse.processing.org/t/checkbox-switch/28334 "2021-03-08T10:47:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Mem](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@Mem](https://discourse.processing.org/u/Mem)
#### Post date: [March 8, 2021, 10:47am UTC](https://discourse.processing.org/t/checkbox-switch/28334/1 "2021-03-08T10:47:50Z")

</div>

Hi,

I would like to be able to select different circle A,B

When the A is selected and we select the B, the circle A should disappear and the checkbox A must be unchecked

Here is the exemple :

Thank you

var checkbox\_a, checkbox\_b;  
var checkbox\_a\_go, checkbox\_b\_go;

function setup() {  
createCanvas(400, 400);

checkbox\_a = createCheckbox(‘A’, false);  
checkbox\_a.position(20, height + 20);  
checkbox\_a.changed(aaa);

checkbox\_b = createCheckbox(‘B’, false);  
checkbox\_b.position(60, height + 20);  
checkbox\_b.changed(bbb);

}

aaa = function(){  
checkbox\_a\_go = !checkbox\_a\_go;  
if(this.checked()){  
//checkbox\_b\_go = false;  
//checkbox\_c\_go = false;  
}}

bbb = function(){  
checkbox\_b\_go = !checkbox\_b\_go;  
if(this.checked()){  
//checkbox\_a\_go = false;  
// checkbox\_c\_go = false;  
}}

function draw() {  
background(220);

if(checkbox\_a\_go === true){  
ellipse(50,50,100,100)  
}

if(checkbox\_b\_go === true){  
ellipse(200,200,200,200)  
}

}
