Friedrich Dominicus wrote:Bernat Romagosa <tibabenfortlapalanca@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@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