Here is a brief tutorial on how to make a clickable hyperlink in Max/MSP 5. This tutorial assumes that you have basic familiarity with Max/MSP 5.
You will need….
- A patch
- A web page you want to link to
- Some text to use for the link
- A text button
- About 20 minutes, give or take
Step 1: Create and setup text button
Choose text button from your new objects. Once the button is created, use Apple-I to access the Text Button inspector. You can use most of the defaults that Text Button has, change some, and leave some alone. If I have not specified below, then the option can be left alone (for now):
- Border thickness: 0 <— Set this
- Include in presentation: checked <— Set this if you are using presentation mode
- Ignore Click: unchecked
- Annotation: none
- Hint: none
- Scripting name: none
- Mode: Button
- Link button size to font size: checked <— Set this
- Output mode: Mouse down <— Set this
Once the button is created, you’ll need to set a text for it. This can be done in the inspector, by double-clicking Text “Off” Label. For this example, I’ll type in This is my link text.
Now we have a text button with the correct text. It can be edited at any point later on as well.
Step 2: Set colors
You’ll need to set colors for the button so that it’s no longer a button as such, but rather a bit of clickable text. The most important part is to set all the background colors to the background you are working with, and turn borders off. This will leave you with only the text. Select the new text button and use Apple-I to access the inspector. Change the first four background colors to the color of your background (white for this example)
Step 3: Set text colors.
Using the Patcher inspector, set Text Color (Off Mouseover) to an obvious color. This will be the color of your hyperlink. I like to use a blue 0,0,255 to make it look like a weblink. This will make the text change color when the user hovers over it. You can leave border colors alone, by the way, if you remembered to set Border Thickness to 0. If not, do so now. Set Text Color (Off) to your standard text color. Most of the time, it will be black 0,0,0 but that may vary depending on your interface. Set Text Color (On Mouseover) and Text Color (On) to the color that will appear when the user clicks the link. I like to use a lighter blue for this, but anything will do.
Step 4: Set destination
Create a new message with the following format:
max launchbrowser http://jnote.org/1347
using your link instead of mine. You will need the semicolon with the space (new line) after it. Connect the text button’s first outlet to the message’s inlet and you are pretty much ready to go. You can use text before your new hyper link by sending your button to the background and overlaying a comment box (see picture below). You can hide all patch cords by selecting them and using Apple-K. Alternatively, you can just use presentation mode and only add your button and accompanying text.
Note: Due to a strange bug (?), if you connect a text button to the above launchbrower message, then the button will stay in “On” mode after the user clicks it. In other words, it won’t go back to it’s off state until you hover over it again. I couldn’t find an elegant way to get around this problem, so I have left it for now.
Note 2: you can also choose to have the link appear as underlined. This is generally a good idea, since it makes the user aware that it’s a link. You can set this through text button’s inspector as well.