简体   繁体   English

在Moose中,为什么不能用动作填充动态演示?

[英]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.

相关问题 为什么不执行我的操作的快捷方式? - Why won't my action's shortcut be executed? 我可以使用我的方法扩展内置的String类 - Can I extend built-in String class with my methods 是什么让Smalltalk能够进行图像持久化,为什么像Ruby / Python这样的语言不能自行序列化? - What gives Smalltalk the ability to do image persistence, and why can't languages like Ruby/Python serialize themselves? 为什么不能在从Dictionary-class派生的类中重写#at:put:方法? - Why can't I override the #at:put: method in a class derived from the Dictionary-class? Smalltalk中真的没有预定义的动态2D容器吗? 我必须自己做吗? - Is there really no predefined dynamic 2d container in Smalltalk? Do I have to make my own? 我可以要求在Metacello配置中特定提交另一个Metacello ConfigurationOf吗? - Can i require a specific commit of another Metacello ConfigurationOf in my Metacello configuration? 为什么我不能创建一个新的子类并在同一个句子中使用它? - Why can I not create a new subclass and use it in the same sentence? 吱吱作响的小话,为什么有时简化的方法不起作用? - Squeak Smalltalk, why sometimes the reduced method doesn't work? 向操作过魅力文字或Smalltalk代码演示的用户询问“保存或放弃编辑” - Ask “Save or Discard edits” to user that has manipulated a Glamour Text or Smalltalk code presentation 为什么我不应该存储在Smalltalk中的文字数组中? - Why shouldn't I store into literal arrays in Smalltalk?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM