- If you want to make use of a menu bar, then create instances of the
Menu class by instantiating the following pattern inside the
definition of the createViews method:
Menu new
title: menu-naming string;
owner: self;
appendItem: item-naming string
selector: #view-manager method name;
appendItem: another item-naming string
selector: #another view-manager method name;
...
- If you want to have a program react when a particular menu item has
been selected, then define a
view manager method named by a
appendItem:selector: message.
- If you want to specify submenus, then use the
appendSubMenu: method, rather than the appendItem:selector: method:
Menu new
title: menu-naming string;
owner: self;
appendSubMenu: (Menu new
title: menu-naming string;
owner: self;
...);
appendSubMenu: (Menu new
title: another menu-naming string;
owner: self;
...);
...
- If you want to tie a menu to a menu window, then instantiate the
following pattern in the definition of the
createViews method:
...
the top pane menuWindow: (theMenuWindow := MenuWindow new).
...
the menu window addMenu: a menu
...
- If you want to open a file-dialog window, then instantiate the following pattern:
(file-dialog variable := FileDialog new)
fileSpec: file-specifying string;
open.
FileDialog instances answer a file name when sent the file
message if you have clicked the Open button; such instances answer
nil when sent the file message if you have clicked
the cancel button.
- If you want to extract and make use of the file name answered by a
file-dialog window, then instantiate the following pattern:
(file name := file-dialog variable file) notNil
ifTrue: [appropriate action-specifying expressions].