Hi,

On Mon, Aug 7, 2017 at 9:44 AM, Luke Gorrie <luke@snabb.co> wrote:
Hoi,

What is the best way for an object to delegate one or more GTInspector views to other objects?

I have been using a pattern like this:

gtInspectorFooIn: composite
   <gtInspectorPresentationOrder: 5>
   otherObject gtInspectorFooIn: composite

This is indeed the normal way of delegating the construction of a view to another object. Just if otherObject can be nil it might be better to use an accessor that ensures the object is present. If that's not an option then either add a nil check or use a dynamic presentation.
 

but I am wondering whether there is a better way, and also whether this method is valid (I've occasionally seen odd behavior, like Inspector panes disappearing after I "Refresh", and I wonder if I could be somehow confusing the model or if this is not relevant.)

Should not be relevant. But there can always be a bug. If you find a reproducible case that would help. Also when reusing presentations like above it's better to define the #display block like this 'display: [ self computeValuesToDisplay ] ' instead of 'display: [ :each | each computeValuesToDisplay ]'.
 

also: Supposing this pattern is valid, is there an easy way to override the title of the view(s) added by otherObject?

If you return the actual presentation then you can customize any property of that presentation:

gtInspectorFooIn: composite
   <gtInspectorPresentationOrder: 5>
   
   ^ (otherObject gtInspectorFooIn: composite)
     title: 'Another title'

 
Cheers,
Andrei



_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev