/usr/share/SuperCollider/HelpSource/Classes/PopUpMenu.schelp is in supercollider-common 1:3.6.3~repack-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | CLASS:: PopUpMenu
redirect:: implClass
summary:: A view displaying a text item selectable from a drop-down menu.
categories:: GUI>Views
DESCRIPTION::
When clicked, this view opens a menu containing several text items, then closes the menu and displays one of the items after it is selected.
CLASSMETHODS::
PRIVATE:: key
INSTANCEMETHODS::
SUBSECTION:: Data
METHOD:: items
The list of items displayed in a menu when the view is clicked.
argument::
An Array of Strings or Symbols.
METHOD:: clear
note:: Only available in Qt GUI ::
Removes all items.
METHOD:: item
The currently selected item.
returns::
A String.
METHOD:: value
The index of the currently selected item.
argument::
An integer, or nil meaning no selected item.
METHOD:: valueAction
Sets link::#-value:: and triggeres link::#-action::.
argument::
An integer, or nil meaning no selected item.
SUBSECTION:: Appearance
METHOD:: stringColor
The color used to display text.
argument::
A Color.
METHOD:: background
Setting this variable colors the area of the view under the text with the given color.
argument::
A Color.
SUBSECTION:: Interaction
METHOD:: allowsReselection
Determines whether the action is triggered when selecting already selected item. Defaults to false.
argument::
A Boolean.
SUBSECTION:: Actions
METHOD:: action
The action object evaluated whenever the user changes the selected item from the menu. See link::#-allowsReselection:: for customization.
SUBSECTION:: Drag and drop
METHOD:: defaultGetDrag
returns::
The link::#-value::.
METHOD:: defaultCanReceiveDrag
returns::
True if the current drag data is a number.
METHOD:: defaultReceiveDrag
Sets link::#-valueAction:: to the current drag data.
EXAMPLES::
subsection:: Basic Example
code::
(
w = Window.new("The Eightfold Path").front;
m = PopUpMenu(w,Rect(10,10,180,20));
m.items = [
"right view","right thinking","right mindfulness","right speech",
"right action","right diligence","right concentration","right livelihood"
];
m.background_(Color.green(0.7)); // only changes the look of displayed item
m.stringColor_(Color.white); // only changes the look of displayed item
m.font_(Font("Courier", 13)); // only changes the look of displayed item
m.action = { arg menu;
[menu.value, menu.item].postln;
};
)
m.value; // returns the index of the current item;
m.item; // returns the String or Symbol of the current item
m.value_(2); // changes the displayed item, but does not evaluate the action
m.valueAction_(3); // evaluates the action.
::
subsection:: Sound Example
Play different functions:
code::
(
s.waitForBoot({
var w,menu,snd,funcs,b;
w=Window.new.front;
menu=PopUpMenu(w,Rect(10,10,90,20))
.items_(["Sine" , "Saw" , "Noise" , "Pulse"]);
funcs=[
{SinOsc.ar(440,0,0.3)},
{Saw.ar(440,0.3)},
{WhiteNoise.ar(0.3)},
{Pulse.ar(440,0.2,0.3)}
];
b=Button(w,Rect(110,10,180,20))
.states_([["play",Color.black,Color.green]])
.mouseDownAction_({
snd = funcs.at(menu.value).play;
})
.action_({ arg butt, mod;
snd.free;
});
w.front;
p=CmdPeriod.add({b.value_(0)}); // set button to 0 on hitting Cmd-period
w.onClose_{ snd.free; CmdPeriod.removeAll }; // clean up when window is closed
})
)
::
|