[Pharo-users] What's wrong with this code?

Nicolai Hess nicolaihess at web.de
Wed Mar 19 12:11:56 EDT 2014


I think the ProgressNotification was only used in
older pharo version (like 1.4, where this displayProgress: ...
with progress title worked)


2014-03-19 16:46 GMT+01:00 Ben Coman <btc at openinworld.com>:

>  Friedrich Dominicus wrote:
>
> Bernat Romagosa <tibabenfortlapalanca at gmail.com> <tibabenfortlapalanca at gmail.com> writes:
>
>
>
>  ouch, I added a . in the middle, sorry!
>
> elements := #('eins' 'zwei' 'drei' 'vier').
> elements
> do: [ :element | (Delay forSeconds: 2) wait ]
> displayingProgress: [ :element | 'Working on', element asString ].
>
> 2014-03-18 9:55 GMT+01:00 Bernat Romagosa<tibabenfortlapalanca at gmail.com> <tibabenfortlapalanca at gmail.com>:
>
>     Without having tried it, I think you're missing a #wait message in
>     there:
>
>
>
>     elements := #('eins' 'zwei' 'drei' 'vier').
>     elements do: [ :element | (Delay forSeconds: 2) wait ].
>
>     displayingProgress: [ :element | 'Working on', element asString ].
>
>
>  Sorry even with that I do not see the 'Working on ' message.
> It's just a progress bar with nothing else. No "Working on" anywhere.
>
> Regards
> Friedrich
>
>
>
>
>
> I'm not sure what the expected result is, but if you debug/step into that
> code a few times you find yourself in...
>     Array(Collection)>>do:displayingProgress:every:
>
> Looking at expression...
>      aStringOrBlock isString
> I guessed something might be learnt from stepping through...
>     elements := #('eins' 'zwei' 'drei' 'vier').
>     elements do: [ :element | (Delay forSeconds: 2) wait ]
> displayingProgress: 'MyProgress'
> and indeed progress bar text is updated by the line...
>     bar label: aStringOrBlock.
>
> Now stepping through your original script, #label: never seems to be
> executed
> So replacing...
>     [ProgressNotification signal: '' extra: (oldLabel := newLabel)]
> with...
>     [   bar label: newLabel.
>         ProgressNotification signal: '' extra: (oldLabel := newLabel).
>     ].
> seems to do the trick, although as I said before, I don't know what the
> expected behaviour is.  Is that what you need?
>
> I've not looked at this code before so I've learnt something new today. In
> particular, for a while I was wondering purpose ProgressNotification served
> since tracing through it seemed to do nothing, and then I realised it might
> be used something like this...
>     elements := #('eins' 'zwei' 'drei' 'vier' ).
>     [   elements do: [ :element | (Delay forSeconds: 2) wait ]
>         displayingProgress: [ :element | 'Working on ', element asString ]
>     ] on: ProgressNotification do:
>     [     :notice |
>           self inform: notice extraParam printString.
>           notice resume
>     ]
>
> I've logged a case
> https://pharo.fogbugz.com/f/cases/13101/Progress-bar-progressive-text-update-not-working
>
> cheers -ben
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20140319/6dbc4a74/attachment.html>


More information about the Pharo-users mailing list