[Q] FillInTheBlankMorph>>getUserResponse evil?

Ken Causey ken at ineffable.com
Fri May 10 18:50:50 UTC 2002


FillInTheBlankMorph>>getUserResponse
	"Wait for the user to accept or cancel, and answer the result string.
Answers the empty string if the user cancels."
	"Details: This is invoked synchronously from the caller. In order to
keep processing inputs and updating the screen while waiting for the
user to respond, this method has its own version of the World's event
loop."

	| w |
	w _ self world.
	w ifNil: [^ response].
	done _ false.
	[done] whileFalse: [World doOneCycle].
	self delete.
	World doOneCycle.
	^ response

Maybe it's just me, but this seems evil and hacky.  However, I'm now in
the position of needing a slightly more complex dialog and my code
really wants to wait for the response before continuing.  Is this logic
the current best choice for waiting for a response from the user?  I
can't seem to come up with a better solution so far.

Waiting eagerly,

Ken Causey




More information about the Squeak-dev mailing list