[bug] ?

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

[bug] ?

keith1y
I am attempting to add labels to an MASingleOptionDescription.

as in:

descriptionImprintChooser
    ^MASingleOptionDescription new
        auto: 'imprint';
        options: [ PRCurrentContext value currentUserImprints ]
asDynamicObject;
        propertyAt: #labels put:  [ ... build a dictionary here ... ]
asDynamicObject;
        label: 'Imprint';
        priority: 140;
        bePersisted;
        yourself

however I suspect that an addition of "yourself" is needed for this to work:

MAOptionDescription-labelForOption: anObject
    self propertyAt: #labels ifPresent: [ :labels |
        labels /yourself/ at: anObject ifPresent: [ :value |
            ^ value ] ].
    ^ self reference toString: anObject

Instead I chose to implement the above by supplying a selector whch can
be performed on the object to obtain its label...

labelForOption: anObject
    self propertyAt: #labelSelector ifPresent: [ :selector |
        ^ anObject perform: #labelSelector ].
   
    self propertyAt: #labels ifPresent: [ :labels |
        labels yourself at: anObject ifPresent: [ :value |
            ^ value ] ].
    ^ self reference toString: anObject

cheers

Keith

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki