Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Dynamic open menu
Last updated at 10:31 am UTC on 5 April 2019
With changeset 5105 (SqueakMapHooks-sw) a dynamic portion to TheWorldMenu was added.
This is also what is shown in the Apps menu.

Depending on what is loaded this may be





SqueakMap appear in the dynamic portion of the menu; when they are removed from the system, they disappear from the menu; when they return, they reappear in the menu.

Participation in the dynamic portion of the open menu requires the implementation of three methods in clients:

1. The GUI class #initialize should call #registerOpenCommand:.
2. The GUI class #unload should call #unregisterOpenCommand:,
3. And it should have some unary message to open the GUI.

It is possible to Provide balloon help for all the items in the open menu, including the dynamic ones.


A typical initialization method of a client package which likes to install a menu entry in Dynamic open menu looks like this:

Class SMLoader

 initialize

  (TheWorldMenu respondsTo: #registerOpenCommand:)
  ifTrue: [TheWorldMenu registerOpenCommand: {'Package Loader'. {self. #open}}].


 registerOpenCommand: anArray
	"The array received should be of form {'A Label String'. {TargetObject. #command}  'A Help String'} ; 
         the final element is optional but if present will be used to supply balloon help for the menu item in the Open menu.
	If any previous registration of the same label string is already known, delete the old one."

	self unregisterOpenCommand: anArray first.
	OpenMenuRegistry addLast: anArray



The code to unregister:

 removeFromSystem
  (TheWorldMenu respondsTo: #registerOpenCommand:) ifTrue: 
	[TheWorldMenu unregisterOpenCommand: 'Package Loader'].
   super removeFromSystem


See also

Subclassing MorphicProject, TheWorldMenu and PasteUpMorph