sets up event handling so that lcicking a box changes the state on the parent compoennt