May 2018
Beginner
252 pages
6h 19m
English
The fact that actors are objects becomes very much apparent when we see how menu events are defined in Red. The definition of a menu starts by declaring a layout object. Then, via a /menu field, the menu titles and submenus are defined as a list. Each submenu is a deeper nested level in the list, for example:
; see Chapter09/menu.red:mex: layout [title "Menu example" ar: area cyan 400x400]mex/menu: [ "File" [ "Load" load --- "Save" sv --- "Save As" svas --- "Print" prnt ] "Sub-menus" [ "Submenu1" s1 "Submenu2" s2 "Submenu3" [ "Submenu4" s4 "Submenu5" s5 ] ] "Tools" [ "Text Size" txts ] "Help" [ "Some Help" hlp ] "Quit" [ "Close all" qt]]
Each menu item has a title as a string and a word, which stores the event that occurs when this ...