Spec / GT Inspector integration
If I have a CompositeModel which I want to display as a tab in a GT Inspector, what should the inspector method look like? (I haven't been able to find any examples in the image or on the web) I assume it should be something like: gtInspectEditIn: composite <gtInspectorPresentationOrder: 50> ^ composite spec title: 'Edit'; display: [ :anObject | MyCompositeModelEditor on: anObject ]. But it isn't clear to me what the display block should be returning. I can successfully open the window using: MyCompositeModelEditor new editObject: anObject; openWithSpec. Thanks, Alistair
Hi Alistair, 2016-09-01 10:38 GMT+02:00 Alistair Grant <akgrant0710@gmail.com>:
If I have a CompositeModel which I want to display as a tab in a GT Inspector, what should the inspector method look like? (I haven't been able to find any examples in the image or on the web)
I assume it should be something like:
gtInspectEditIn: composite <gtInspectorPresentationOrder: 50>
^ composite spec title: 'Edit'; display: [ :anObject | MyCompositeModelEditor on: anObject ].
But it isn't clear to me what the display block should be returning.
The model *after* building the widget with #buildWithSpec
I can successfully open the window using:
MyCompositeModelEditor new editObject: anObject; openWithSpec.
Here is an example how you can create a spec based presentation (an IconListModel) ). Add this method to the other gtInspectorMethods for class Morph (instance side): gtInspectorSubmorphs2In: composite <gtInspectorPresentationOrder: 80> composite spec title: 'Submorphs2'; display: [:each ||lm| lm:= IconListModel new. lm items: each submorphs. lm icons:[:item | item taskThumbnailOfSize: (16@16) ]. lm displayBlock:[:item | item printString -> item class name]. lm buildWithSpec. lm ]
Thanks, Alistair
Hi Nicolai, On Thu, Sep 01, 2016 at 11:00:29AM +0200, Nicolai Hess wrote:
...
Here is an example how you can create a spec based presentation (an IconListModel) ). Add this method to the other gtInspectorMethods for class Morph (instance side):
gtInspectorSubmorphs2In: composite    <gtInspectorPresentationOrder: 80>    composite spec       title: 'Submorphs2';       display: [:each ||lm|          lm:= IconListModel new.          lm items: each submorphs.          lm icons:[:item | item taskThumbnailOfSize: (16@16) ].          lm displayBlock:[:item | item printString -> item class name].          lm buildWithSpec.          lm          ]
Perfect, thank you! I've made a note to create an example, either as a comment or using GT Examples, and submit it back for inclusion in the core image. Thanks again, Alistair
participants (2)
-
Alistair Grant -
Nicolai Hess