Transcript problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Transcript problem

John Trinder
If I evaluate the following in a WS:

Transcript show. 1 to: 100 do: [ :i | Transcript clear; print: i;
flush. (Delay forMilliseconds: 1000) wait]

The Transcript doesn't display anything.
I'm sure it's something simple ;)


Reply | Threaded
Open this post in threaded view
|

Re: Transcript problem

Ian Bartholomew-14
John,

> If I evaluate the following in a WS:
>
> Transcript show. 1 to: 100 do: [ :i | Transcript clear; print: i;
> flush. (Delay forMilliseconds: 1000) wait]
>
> The Transcript doesn't display anything.
> I'm sure it's something simple ;)

You're putting a Delay in the main UI process, which is the process that
should be keeping the Transcript up to date - as is being delayed it cannot
do so. Whether delaying the UI process is generally (as I have always
thought) a bad idea or whether it's down to the possible bug mentioned
earlier this month (the "Bug in Event Loop?" thread) I'm not sure.

Running the loop in a forked process, so that the main UI process remains
responsive, solves this particular case.

[Transcript show.
1 to: 100 do: [ :i |
    Transcript
        clear;
        print: i;
        flush.
        (Delay forMilliseconds: 1000) wait]] fork

Regards
    Ian