Click event on checkbox?

Is it possible to attach an event to a checkbox? I figured out how to check all the child nodes. Now I would like to fire that function when I check the parent node’s respective checkbox.

It possible to attach event, which will fire when checkbox state changed by mouse click
xtree.attachEvent(“onCheck”,function(id){
//any code here
return true;
});

There is no way to catch moment, when checkbox checked because of API call or because of 3-state checkboxes logic.