Attach event to two state button

I made a toolbar with three ‘two-state-button’ but I don’t know how to attach event to it and detect when are pressed or not.

var toolbar_1 = main_layout.attachToolbar();
toolbar_1.setIconSize(32);
toolbar_1.setIconsPath(‘./codebase/imgs/32/’);

toolbar_1.setAlign(“right”);
toolbar_1.addButtonTwoState(“drag”, null, null, “…/…/icons/drag.png”, null);
toolbar_1.addButtonTwoState(“rotate”, null, null, “…/…/icons/rot.png”, null);
toolbar_1.addButtonTwoState(“vertice”, null, null, “…/…/icons/vert.png”, null);

Here’s how I do it

[code]{
type: ‘buttonTwoState’, id: ‘…’, text: ‘…’, img: “…”, isbig: true, state: true,
onclick: function (id) {
//Do stuff when clicked
}

}[/code]

Note: That is with a json init

Also Note: That is for a Ribbon buttontwostate

Found the toolbar code, docs.dhtmlx.com/toolbar__two_state_button.html

myToolbar.setItemState(id, state, callEvent);

The parameters for this method are the following:
id - id of the two-state button;
state - true/false, true stands for the Pressed state of the button, false stands for the Released state of the button;
callEvent - if set to true, calls user defined handler for the onStateChange event (if there is any).