在Pharo 3中,使用MultiColumnListModel在菜单中单击鼠标右键将显示MessageNotUnderstood,如以下示例代码所示:

| specModel list itemMenu group1 item1 |

itemMenu := MenuModel new.
item1 := MenuItemModel new
    name: 'Browse';
    shortcut: $b command;
    enabled: true;
    action: [ self halt ];
    yourself.
group1 := MenuGroupModel new
    addMenuItem: item1;
    autoRefresh: true;
    yourself.
itemMenu addMenuGroup: group1.

specModel := DynamicComposableModel new
    instantiateModels: #(list MultiColumnListModel);
    yourself.
list := specModel list
    items: {$a. $b. $c. $d. $f.};
    displayBlock: [:e | {e asString. e isVowel asString} ];
    menu: itemMenu;
    yourself.
specModel
    openWithSpecLayout: (SpecLayout composed
        newRow: [: r | r add: #list ];
        yourself).


这是Spec中的错误还是我遗漏了一些东西?

最佳答案

那是Spec中一个众所周知的当前错误。在几个地方,右键单击MNU

关于menuitem - 在Spec的MultiColumnList中打开菜单会得到MNU,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24624244/

10-14 17:55