On 7 August 2017 at 11:02, Andrei Chis <chisvasileandrei(a)gmail.com> wrote:
Hi,
On Mon, Aug 7, 2017 at 9:44 AM, Luke Gorrie <luke(a)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.
Here is the part that I am missing: How do I tell the Inspector that the
*value* to inspect is otherObject instead of self?
I mean, it seems like this code constructs the GLMPresentation for
otherObject but then applies it to self, which may not be compatible.
Maybe I should add 'display: [ otherObject ]' ?
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.
I have not finally tracked down this issue yet but it seems to be related
to error cases e.g. pressing "Abandon" in the debugger. Symptom is that the
first pane of the inspector mysteriously disappears. I will open an issue
when I know how to reproduce it.