December 3, 2004, 12:00 am
for sc2
/*
finds all classes that match the partial string you enter.
for instance you can type in Abstract and get all classes that have the word
Abstract somewhere in their name. its a little bit goofy in that in will match anagrams,
but most of the time you find exactly what you were looking for.
*/
Library.put([Tests,classfinder],{
GetStringDialog("Classname or partial string","",{
arg ok,string;
var matches,f,classes;
matches = IdentitySet.new;
if(ok,{
classes = Class.allClasses.reject({ arg cl; cl.class === Class });
classes.do({ arg cl;
if(cl.name.asString.copyRange(0,string.size - 1) == string,{
matches = matches.add(cl);
})
});
// goofy anagram check
classes.do({ arg cl;
if(cl.name.asString.includesAll(string),{
matches = matches.add(cl);
})
});
f = FlowLayout.new;
matches.do({ arg cl;
ActionButton(f.startRow,cl.name,{
cl.gui;
//cl.newErrorWindow.name.postln;
},200);
});
f.resizeWindowToFit;
})
});
});
Rgds!