[英]In Moose, why can't I populate my dynamic presentation with an action?
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. 两者都应该做同样的事情:在文本视图中按下apple-k时停止。 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.
在内部演示文稿中添加selectionPopulate:on:entitled:with:即可。
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 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.