Change getText in WidgetHandler to use reflection. Fixes #503