Event handling in widgets refactored.