-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAssignButton.sc
52 lines (40 loc) · 1.09 KB
/
AssignButton.sc
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
AssignButton {
var <>win, <>bounds, <>instantButton, <>instantAction;
*new {arg win, bounds;
^super.new.win_(win).bounds_(bounds).init;
}
init {
instantAction = {};
instantButton = Button.new(win, bounds)
.states_([ [ "AI", Color.red, Color.black ] ,[ "C", Color.black, Color.red ] ])
.action_{|v|
instantAction.(v);
};
if(bounds==nil,{instantButton.maxHeight_(15).maxWidth_(60)});
}
setBounds {arg boundsIn;
bounds = boundsIn;
instantButton.bounds_(bounds);
}
maxWidth_{arg max; instantButton.maxWidth_(max)}
maxHeight_{arg max; instantButton.maxHeight_(max)}
layout {^instantButton}
asView {^instantButton}
setInstBut {arg val; instantButton.value = val}
}
TypeOSCAssignButton {
var <>instantButton, <>instantAction;
*new {
^super.new.init;
}
init {
instantAction = {};
instantButton = Button().font_(Font("Helvetica", 10)).maxWidth_(15).maxHeight_(15)
.states_([["AI",Color.red,Color.black],["OK",Color.black,Color.red]])
.action_({arg butt;
instantAction.(butt);
});
}
asView {^instantButton}
setInstBut {arg val; instantButton.value = val}
}