apologies for butting in here, but this might be one way of doing what you want (from your description)
run it, change (0,1) to 40 [enter], click the toggleButton for selection --> row should change to blue foreground,
then click again to unselect it --> row reverts to normal color.
(I've stripped everything unrelated to the specific problem)