Making pop-up menus in custom Quartz Composer patches is actually surprisingly easy.
This release is only compatible with Tiger (10.4).
Please see kineme.net for Leopard-specific informations.
Please see kineme.net for Leopard-specific informations.
- Set up a QCIndexPort input. QCIndexPorts provide values from 0 to whatever max you specify using
- (void)setMaxIndexValue:(unsigned int)max;
.
@interface IndexPortPopUpDemoPatch : QCPatch { QCIndexPort *inputPerson; } ... @end
- Add the “menu” key to the port’s input attributes:
<key>inputAttributes</key> <dict> <key>inputPerson</key> <dict> <key>description</key> <string>Person</string> <key>name</key> <string>Person</string> <key>menu</key> <array> <string>Arthur Dent</string> <string>Ford Prefect</string> <string>Zaphod Beeblebrox</string> <string>Marvin</string> <string>Trillian</string> <string>Slartibartfast</string> <string>Agrajag</string> <string>Wonko the Sane</string> </array> </dict> </dict>
- Make sure you set the max index value in the
initWithIdentifier
function:
- (id)initWithIdentifier:(id)fp8 { id z=[super initWithIdentifier:fp8]; [inputPerson setMaxIndexValue:7]; return z; }
- Read the value out of the QCIndexPort using
- (unsigned int)indexValue;
.
Steve Mokris is a developer at Kosada, Inc.