Hi,
The way you make presentations reusable in other contexts id by making gtInspectorFooIn:
display self. Something like this
SomeOtherClass>>#gtInspectorFooIn: ccomposite
<gtInspectorPresentationOrder: 5>
composite text display: [ :ignoredObject | self … ] …
So, the display block depends on self and not on the object you get in the block.
Like this, when you do:
SomeClass>>gtInspectorFooIn: composite
<gtInspectorPresentationOrder: 5>
otherObject gtInspectorFooIn: composite
You will actually apply the inner presentation on otherObject (instance of
SomeOtherClass), rather than on the current object (instance of SomeClass).
Does it make sense?
Cheers,
Doru
On Sep 8, 2017, at 11:02 AM, Luke Gorrie
<luke(a)snabb.co> wrote:
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.
_______________________________________________
Moose-dev mailing list
Moose-dev(a)list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev
--
www.tudorgirba.com
www.feenk.com
"Value is always contextual."