[sc-users] determining if a class exists

chris chris at oedo.net
Mon Dec 4 14:28:05 PST 2006


Sciss wrote:
> from GUI.swing :
> 
>     if( \JSCWindow.asClass.isNil, { warn( "You do not seem to have 
> SwingOSC installed - JSCWindow is missing." )});

ya, that's what i ended up using... :) for maximum compatibility (the 
mac i was testing on didn't even have the GUI class ;6 ) i wrote 
something along these lines

{
GUIHelper {
	*window {
		if (\JSCWindow.asClass.isNil, {
			^SCWindow;
		},{
			^JSCWindow;
		});
	}
	
... button, slider, textfield the same

}

i know there are more elegant solutions (such as that in GUI itself) but 
this works nicely for a simple fix

cheers!
chris


More information about the sc-users mailing list