Hi Jupiter,

Thanks for that. It solved the issue. Are you by chance aware of a decent sample application that is based Magritte that I can load in a Pharo image? Or maybe even one based on TWBS (Twitter Bootstrap) for Magritte?

Cheers,

Roger

On 31 May 2015 at 08:52, Jupiter Jones <jupiter.jones@mail.com> wrote:
Hi Roger,

I seem to remember the same issue with display - I can’t remember if it’s called at all. :)

Regardless, I opted to set a reference description along the lines of:

locationsDescription
<magritteDescription>
 | template |
 template := GeoLocation new.
 ^ MAToManyRelationDescription new
   accessor: #’geoLocations';
   classes: { GeoLocation };
   label: ‘Locations';
   reference: template descriptionDisplayString asContainer;
   yourself

…and the descriptionDisplayString would be something like:

descriptionDisplayString
 "<magritteDescription> note the comment to stop this becoming part of the default description"
 ^ MAStringDescription new
   accessor: #’printString';
   label: ‘Location';
   priority: 100;
   beReadonly;
   yourself

Let me know how it goes.

Cheers,

J

> On 30 May 2015, at 12:09 am, Rogier Schaaf <rogier.schaaf@gmail.com> wrote:
>
> I have a default Magritte edit form for a model that maintains a relation to a single instance of GeoLocation, a model object with two instance variables: longitude and latitude. The relation is defined as a MAToOneRelationDescription.
>
> On the form, the instance of GeoLocation is displayed as the integer of the longitude attribute, however I want a representation like:
>
> lon: 12.67, lat: 34.09
>
> I looked at MAToOneRelationDescription and its superclass MAElementDescription implements a #display: method which either accepts a symbol or a block to customize the display. I've implemented a #printString method with GeoLocation and passed that to the relation description as:
>
> display: #printString
>
> and
>
> display: [ :anObject | ^ anObject printString ]
>
> But as far as I can tell both the symbol and the block get ignored when displaying the GeoLocation instance in the Magritte form.
>
> What should I change to get the required display?
>
> Thanks,
>
> Roger
> _______________________________________________
> Magritte, Pier and Related Tools ...
> https://www.iam.unibe.ch/mailman/listinfo/smallwiki


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