Download Max Tutorial Manual - Electronic Art and Design
Transcript
Designing the User Interface Tutorial 45 With the menubar object you can add your own menus and commands to the menu bar. The argument to menubar tells it how many menus you want there to be. (There must be four menus. These are the Help, File, Edit, and Windows menus.) Then you type in a script that explains to menubar where you want it to put additional menus and commands. (See menubar in the Max Reference Manual for details on writing the script.) In our case, we want to change the first item in the Help menu from About Max... to About Note Modifier..., and we want to add a new menu called Modify that contains the new commands we want. The script is as follows: #X about About Note Modifier...; #X menutitle 5 Modify; #X item 5 1 Track A/1; #X item 5 2 Track B/2; #X item 5 3 Track C/3; #X item 5 4 Track D/4; #X item 5 5 -; #X item 5 6 Keyboard/K; #X item 5 7 -; #X item 5 8 Panic/P; #X end; The / character is special, indicating that the character the follows it should be the keyboard shortcut associated with that menu item (Command + <key> on Macintosh or Ctrl + <key> on Windows). The - character is also special, indicating that a gray line should be substituted for an actual menu item at that point in the menu, which is useful for dividing the menu into sections. Once our menu bar is in place, we have three ways to turn tracks on or off: a button, a menu command, and a key command. This introduces a bit more complexity to our programming task, however, because each of the three methods needs to: highlight or unhighlight the button, check or uncheck the menu item, open or close the track window, and enable or disable MIDI in that track window. • To see how this is done, you’ll have to resort to a trick to see the contents of the main patch. Close the 45. Note Modifier window, then re-open it and hold down the Command and Shift keys on Macintosh or Control and Shift keys on Windows as it is opening. This will stop all loadbang objects from sending out their bang messages, and will open the window without hiding the scroll bars and zoom box. Now you can unlock the Patcher and enlarge the window to see how the menubar object triggers the 261