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 |
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 <[hidden email]> 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 |
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 <[hidden email]> wrote: Hi Roger, _______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Have a look at this thread:
http://forum.world.st/where-is-QC-Magritte-Tutorial-tt4766405.html#a4766542 Cheers Kiril |
In reply to this post by Rogier Schaaf
Hi Roger,
Have you looked at QCMagritte - http://www.smalltalkhub.com/#!/~DiegoLont/QCMagritte It’s like jumping in the deep end, but I learnt a lot from it. Cheers, J
_______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Hi Jupiter, Great link, thanks very much! Cheers, Roger On 1 June 2015 at 22:48, Jupiter Jones <[hidden email]> wrote:
_______________________________________________ Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |