gtInspector override default select behavior

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

gtInspector override default select behavior

Evan Donahue
Hello,

I have a gtInspector extension a tree-structured object. By default, when I click on one of the objects in the gtInspector, the inspector opens up another inspector on that node (using the finder-style display).

What I would like to know is, is it possible to override the default click behavior so that, instead of opening the next inspector on that node of the tree, it opens on the result of a block run on that tree. Specifically, I have this:

gtInspectorSource: composite
    <ignoreForCoverage>
    <gtInspectorPresentationOrder: 10>
    composite tree
        title: 'Source';
        children: [ :r | r sourceChildren ];
        format: [ :r | r sourceName ];
        display: self

and I was hoping there was some way I could do something like this:

...
display: self;
onSelectAction: [ :r | r next ]

so when I click, I get an inspector not on the node of the tree r, but on r next.

Thanks,

Evan
Reply | Threaded
Open this post in threaded view
|

Re: gtInspector override default select behavior

Andrei Chis
Hi,

On Mon, Aug 7, 2017 at 5:28 AM, Evan Donahue <[hidden email]> wrote:
Hello,

I have a gtInspector extension a tree-structured object. By default, when I click on one of the objects in the gtInspector, the inspector opens up another inspector on that node (using the finder-style display).

What I would like to know is, is it possible to override the default click behavior so that, instead of opening the next inspector on that node of the tree, it opens on the result of a block run on that tree. Specifically, I have this:

gtInspectorSource: composite
    <ignoreForCoverage>
    <gtInspectorPresentationOrder: 10>
    composite tree
        title: 'Source';
        children: [ :r | r sourceChildren ];
        format: [ :r | r sourceName ];
        display: self

and I was hoping there was some way I could do something like this:

...
display: self;
onSelectAction: [ :r | r next ]

so when I click, I get an inspector not on the node of the tree r, but on r next.

You can get this behaviour by using #send:. This method gets a block that is executed to determine the value that will be sent to the next column.

 composite tree
        title: 'Source';
        children: [ :r | r sourceChildren ];
        format: [ :r | r sourceName ];
        display: self
        send: [ :r | r next ]


Cheers,
Andrei

 

Thanks,

Evan

Reply | Threaded
Open this post in threaded view
|

Re: gtInspector override default select behavior

Evan Donahue
Perfect.

Do you know if these methods are systematically documented anywhere? I feel like if I understood Glamour better these things might be more obvious, but I can never manage to infer the gtInspector calls from the Glamour docs.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: gtInspector override default select behavior

Andrei Chis


On Mon, Aug 7, 2017 at 11:11 PM, Evan Donahue <[hidden email]> wrote:
Perfect.

Do you know if these methods are systematically documented anywhere? I feel
like if I understood Glamour better these things might be more obvious, but
I can never manage to infer the gtInspector calls from the Glamour docs.

The best way to learn about the inspector is by browsing the glamour examples (GLMBasicExamples open) and the inspector presentations from the image (Inspect the class GTInspector and switch to the Extensions tab).
Also themoosebook.org has some documentation about glamour.

Cheers,
Andrei
 

Thanks.



--
View this message in context: http://forum.world.st/gtInspector-override-default-select-behavior-tp4959037p4959141.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.