Keep "pressed" appearance focused when button is pressed

How would one go about this with a dynamically generated series of checkboxes/“Buttons”? ! seem to be failing at it currently. 1