Where should that input come from? Do you want to retrieve the text that user has entered into some widget?

In general it is a bad idea to have long loop in event-based application.