Menu Commands
Program EasyDraw’s File menu contains six commands besides the MRU list: New, Open, Save, Save As, Close, and Exit. The code shown in Listing 9.4 manages these functions.
Subroutine FileIsLoaded sets the program’s controls to an appropriate state depending on whether a drawing is loaded. If no drawing is loaded, the subroutine disables the File menu’s Close, Save, and Save As commands. It also makes the toolbar and drawing area invisible. If a drawing is loaded, the subroutine enables the File menu’s commands and makes the toolbar and drawing area visible.
When the user selects the File menu’s New command, the mnuFileNew_Click event handler executes. It calls DataSafe to see if it safe to discard the current data and exits if ...
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.
Read now
Unlock full access