pharo-users@lists.pharo.org

Any question about pharo is welcome

View all threads

Pharo 11 Spec2 Problem with Transmissions

V
voxkmp@gmail.com
Sat, Sep 9, 2023 12:13 PM

Hi -

I thought I'd use Spec2 transmissions to implement an album exporer. that is, a list of albums next to a list of the tracks on that album next to some information about the track:

A structure like this: albumlist ==> trackList ==> track details

I've had no trouble connecting the album list to the track list, but I cannot connect the tracklist to a label (or textInput for that matter) to show any track details.

I'm using Pharo 11.

defaultLayout

^ SpBoxLayout newHorizontal

add: (albumListPresenter);

add: (trackListPresenter );

add:(writerPresenter);

yourself

initializePresenters

albumListPresenter := self newList.

albumListPresenter display: [ :item | item displayString].

albumListPresenter items: Repository albums.

trackListPresenter := self newList.

trackListPresenter display: [ :item | item displayString].

writerPresenter := self newLabel.

connectPresenters

"The first transmission works perfectly"

albumListPresenter transmitTo:  trackListPresenter  transform: [  :anAlbum | anAlbum tracks ].

"But this similar one does not work - aTrack appears to be null.".

trackListPresenter transmitTo:  writerPresenter    transform: [  :aTrack | aTrack  writerDetails  ].

There are obviously other ways to code this but I thought transmissions would be a good fit here yet I can't quite make it work.

Any help appreciated.

Ken

Hi - I thought I'd use Spec2 transmissions to implement an album exporer. that is, a list of albums next to a list of the tracks on that album next to some information about the track: A structure like this: albumlist ==> trackList ==> track details I've had no trouble connecting the album list to the track list, but I cannot connect the tracklist to a label (or textInput for that matter) to show any track details. I'm using Pharo 11. **defaultLayout** ^ SpBoxLayout newHorizontal add: (albumListPresenter); add: (trackListPresenter ); add:(writerPresenter); yourself **initializePresenters** albumListPresenter := self newList. albumListPresenter display: \[ :item | item displayString\]. albumListPresenter items: Repository albums. trackListPresenter := self newList. trackListPresenter display: \[ :item | item displayString\]. writerPresenter := self newLabel. **connectPresenters** "The first transmission works perfectly" albumListPresenter transmitTo: trackListPresenter transform: \[ :anAlbum | anAlbum tracks \]. "But this similar one does not work - aTrack appears to be null.". trackListPresenter transmitTo: writerPresenter transform: \[ :aTrack | aTrack writerDetails \]. There are obviously other ways to code this but I thought transmissions would be a good fit here yet I can't quite make it work. Any help appreciated. Ken