2 // NSPopupButton tests - blackrain
4 w = SCWindow.new("NSPopupButton", Rect(10,400,400,150));
5 w.onClose_({ [l, f, c].do(_.release) });
6 p = w.dataptr.asNSReturn;
7 l = SCNSObject("NSPopUpButton", "initWithFrame:", [ Rect(10,25,200,22) ]);
9 p.invoke("addSubview:", [ l ], true);
13 c.invoke("setControlSize:", [1], true);
14 c.invoke("setControlTint:", [6], true); // graphite tint
17 f = SCNSObject("NSFont", "fontWithName:size:", ["Lucida Grande", 11]);
19 c.invoke("setFont:", [f], true);
24 l.invoke("addItemWithTitle:", ["Zero"], true);
25 l.invoke("addItemWithTitle:", ["One"], true);
26 l.invoke("addItemWithTitle:", ["Two"], true);
27 l.invoke("addItemWithTitle:", ["Three"], true);
28 l.invoke("addItemWithTitle:", ["Four"], true);
29 l.invoke("addItemWithTitle:", ["Five"], true);
34 l.initAction("doAction:");
35 l.nsAction.action_({ arg v, val;
36 [v, val, l.invoke("indexOfSelectedItem", [], false), l.invoke("titleOfSelectedItem", [], false)].postln;
40 i = l.invoke("selectedItem", [], false)
41 i.invoke("title", [], false);
44 l.invoke("titleOfSelectedItem", [], false);
46 l.invoke("indexOfSelectedItem", [], false);
48 l.invoke("selectItemWithTitle:", ["Five"], false);
50 l.invoke("selectItemWithTitle:", ["whatever"], false);
51 l.invoke("indexOfSelectedItem", [], false);
53 l.invoke("selectItemWithTitle:", ["One"], false);
56 l.invoke("setTitle:", ["Title"], true);
57 l.invoke("setPullsDown:", [true], true);
58 l.invoke("setPullsDown:", [false], true);