Toggle buttons were not properly working as some mouse clicks changed
the button state but did not trigger the action. This bug was fixed by
changing the event listened in the button from "mouse clicked" to "item
state changed".