Why is that necessary? And how would it help? Besides being completely impractical (because the "stuff that takes a while" in my actual code calls all kinds of re-usable HTTP, URL, and XML functions), I don't see how that would change the result at all either way.
Confirmed...same result if I move the 3 lines of sample code into the event loop.
Output:
------ Running ------
Got to beginning of doStuffThatTakesAWhile Function
This line should not get executed if user presses back in less than 10 seconds!
User canceled out of dialog
while true
dlgMsg = wait(10, port)
if type(dlgMsg) = "roMessageDialogEvent" then
if dlgMsg.isScreenClosed() or dlgMsg.isButtonPressed()
Dbg("User canceled out of dialog")
exit while
end if
else if dlgMsg = invalid then
Print("Got to beginning of doStuffThatTakesAWhile Function")
sleep(10000)
Print("This line should not get executed if user presses back in less than 10 seconds!")
endif
end while