Wrap setting events handling machinery for just this purpose in a single function, to not duplicate it all over the code.