Johan

let me know if there is anything that I should do.


Stef


Le 8/9/16 à 01:11, Johan Fabry a écrit :
Excellent, you found a bug in my code!

What happens is that when one item is selected in a list, in the other list the 
currently selected item is de-selected. This causes *both* blocks 
(whenAPIChanged: and whenEventChanged:) to be executed, and depending on what 
order they are executed the behavior is different. (A classical concurrent 
programming problem.) This order apparently changes depending on how many 
windows you have open, et cetera, I guess because of how the announcement 
system is implemented.

So, yes the easiest solution is to remove both ifNil: […] lines. The UI will 
not work as cleanly, but it is a quick fix. Alternatively, and a bit more 
complicated, is to check if the selection in the other list is also empty 
before setting the text to the empty string.

For the sake of the example, I will simply remove  both ifNil: […] lines from 
the documentation.

Thanks for reporting this, and if you have further issues do not hesitate to 
tell us!

--
Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please 
see http://emailcharter.org .

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of 
Chile

On Sep 7, 2016, at 19:51, Matteo <matte...@yahoo.it> wrote:

Hello Johan,
    I've coded all the examples manually, changing the names to avoid
any conflict with the ProtocolBrowser "bundled" in the Pharo 5 image
(i.e. instead of "ProtocolBrowser" I've named my class as "ProtcolFlipper").
But the result is the same.

Things improve if all the "ifNil: [ text text: '' ]" get removed from
the ProtcolFlipper>>initializePresenter method.
Obviously the text pane is no more "cleaned" when deselecting an "api"
or "api-event" row.

I've tried to substitute the "ifNil: [ text text: '' ]" with "ifNil: [
text text: 'api' ] and ifNil: [ text text: 'api-events' ] , respectively
on the "api" and "event" instances, in the ProtocolBrowser >>
initializePresenter method.
In this way I found that "ifNil:" message is sent improperly, i.e. when
a "api-event" row is selected then the message "ifNil:" of the "api"
instance is triggered, and vice-versa.
In some way this is correct: when a "api-event" row is selected then
none of the "api" rows are selected...

However I'm puzzled by the fact that the behavior seems random: creating
3 instances I can get 3 different behaviors.

have you never experienced this?

Maybe I'll check again my code...

thanks,
Matteo




Reply via email to