In Moose, why can't I populate my dynamic presentation with an action?

86 views Asked by At

This works (a debugger comes up):

bubbler := GLMFinder new.
bubbler show: [:a | 
    a text
    selectionPopulate: #selection 
    on: $k 
        entitled: 'Implementors (k)' 
    with: [ :text | text inspect. self halt]].
bubbler openOn: 'Waaaaaaa'

But this doesn't (no debugger comes up):

bubbler := GLMFinder new.
bubbler show: [:a | 
    a dynamic display: (GLMTextPresentation new forSmalltalk);
    selectionPopulate: #selection 
    on: $k 
        entitled: 'Implementors (k)' 
    with: [ :text | text inspect. self halt]].
bubbler openOn: 'Waaaaaaa'

Both are supposed to do the same thing: halt when apple-k is pressed in a text view. However, the second snippet (which uses a dynamic presentation, unlike the first) does not forward the action to its text presentation. So, why's that? How can we associate an action with our dynamic presentation?

1

There are 1 answers

0
bathyscaph On

It seems that actions do not work well in the dynamic presentation. Adding the selectionPopulate:on:entitled:with: to the inner presentation will work.

bubbler := GLMFinder new.
bubbler show: [:a | 
    a dynamic display: 
        (GLMTextPresentation new forSmalltalk;
        selectionPopulate: #selection 
        on: $k 
        entitled: 'Implementors (k)' 
        with: [ :text | text inspect. self halt])
    ].
bubbler openOn: 'Waaaaaaa'