File: EZScroller.schelp

package info (click to toggle)
supercollider 1%3A3.13.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 80,292 kB
  • sloc: cpp: 476,363; lisp: 84,680; ansic: 77,685; sh: 25,509; python: 7,909; makefile: 3,440; perl: 1,964; javascript: 974; xml: 826; java: 677; yacc: 314; lex: 175; objc: 152; ruby: 136
file content (30 lines) | stat: -rw-r--r-- 991 bytes parent folder | download | duplicates (6)
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
class:: EZScroller
summary:: Show a subset of items on gui elements
categories:: GUI>EZ-GUI

description::
EZScroller is a vertical slider that allows displaying different subsets of a dynamically changing list of objects on a fixed number of views by scrolling.

EZScroller is used JITLib guis like link::Classes/NodeProxyEditor::, link::Classes/ProxyMixer::, link::Classes/TdefAllGui::, and link::Classes/PdefAllGui::.

examples::
code::
(
w = Window.new("EZScroller test", Rect(100, 400,200, 100)).front;
// 5 displays
v = { |i| DragBoth.new(w, Rect(0, i * 20, 100, 20)) }.dup(5);
// 12 items
a = (1..12);

e = EZScroller(w, Rect(100,0,14,100), v.size, a.size, { |sc|
	var startIndex = sc.value.asInteger.postcs;
	v.do { |drag, i| drag.object_( a[ (startIndex) + i] ? ""); };
	e.visible_(sc.numItems > sc.maxItems); // hide when not useful
});
e.doAction;
)
// change list a, update ezscroller
a = (1..4); e.numItems_(a.size); e.doAction;

a = (1..8); e.numItems_(a.size); e.doAction;
::