Reworked widget handling logic

Widgets now respond to WM_COMMAND messages by implementing
_on_wm_command.