Menu Tool

A **Menu Tool** is a controller that we picture (and can easily be implemented as) a menu-item in an application menu. It is designed to be portable, loosely coupled code that can be dynamically associated with a view to perform actions.

# Bars, menus and items Menu Tools are organised into groups in which each tool is specified by an individual handler, which is organised into collections of handlers within a script which we call a menu. Finally menus are organised into groups, which we call alternatively Menu Groups, Menubars or Menubar Groups.

# Introspection We use introspection to auto-generate actual menu-items from the code that specifies a menu tool. This code is used to generate the interfaces we use to interact with the tools - classically to create standard application menus - and then to implement their actions - so the same handler is used to draw a menu and to implement it.

For example the handler:

on menu_Help answer "Help" end menu_Help

Will create a menu-item `Hello World` which when interacted with will run the code and display a "Hello World" dialogue.

# Option Edit By default any menu-item can be edited. Holding down the `option-key` while selecting a menu-tool presents a dialogue which allows you to inspect the code directly with the Script Editor, or select `Help` which allow you to view and author the help documentation for that menu-item. This feature aims to give authors a repl like expereince of application development.

Site Owned by: David Bovill