How can I add an item in the World-menu of Pharo 4.0?

给你一囗甜甜゛ 提交于 2019-11-29 07:21:48

Add the following class method to any class you like. Best to make one especially for this purpose and load it to your new images:

WorkspaceWorldMenuItem class>>menuCommandOn: aBuilder

menuCommandOn: aBuilder
<worldMenu>

(aBuilder item: #'Workspace')
    order: 0.1;
    label: 'Workspace';
    action: [ Workspace open ]

The interesting part is the <worldMenu> pragma. You usually put it directly after the selector (and comment) and before any other element in the method.

To have a look at example usage open Finder, choose the Pragmas mode and search for worldMenu (without the angle brackets).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!