Skip to Content
Learn Red ? Fundamentals of Red
book

Learn Red ? Fundamentals of Red

by Ivo Balbaert
May 2018
Beginner content levelBeginner
252 pages
6h 19m
English
Packt Publishing
Content preview from Learn Red ? Fundamentals of Red

Menus

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

How I Built a Personal Board of Directors With GenAI

How I Built a Personal Board of Directors With GenAI

Vipin Gupta
How to Become a Game-Changing Leader

How to Become a Game-Changing Leader

Douglas A. Ready, Alan Mulally
Why AI Demands a New Breed of Leaders

Why AI Demands a New Breed of Leaders

Faisal Hoque, Thomas Davenport, Erik Nelson

Publisher Resources

ISBN: 9781789130706Supplemental Content