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?

没有正确的解决方案

其他提示

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'
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top