This class is meant as an emulation of SCStaticText. last mod: 17-jul-09 sciss
Also refer to JSCView for different behaviour affecting all widgets
no-op / not working | |
different behaviour | |
abbreviation | text label is abbreviated when width too small |
multi-line | multi-line text is not directly supported. A workaround is to use HTML text with <BR> elements (or use JSCTextView instead) |
extended functionality | |
HTML code | you can add text decorations by using a HTML string |
Note: please use the abstraction layer StaticText if possible!
A non-editable static text (label) field.
( var w, f, t; w = JSCWindow.new; f = FlowLayout.new( w.view.bounds ); w.view.decorator = f; t = "The quick brown fox"; JSCStaticText( w, Rect( 20, 20, 340, 50 )).string_( t ).align_( \left ); f.nextLine; JSCStaticText( w, Rect( 20, 20, 340, 50 )).string_( t ).align_( \center ); f.nextLine; x = JSCStaticText( w, Rect( 20, 20, 340, 50 )).string_( t ).align_( \right ); w.front; ) x.font = JFont( "SansSerif", 20 ); x.background = Color.yellow;
Note that in recent SC versions, you can use Umlaute directly in Strings:
x.string = "Überraschung";
In previous versions, and in Psycollider, you have to do a trick to get the proper UTF-8 encoding (www.utf8-zeichentabelle.de):
x.string = "" ++ 0xC3.asAscii ++ 0x9C.asAscii ++ "berraschung"; // Ü occupies two bytes here!
You can introduce text formatting by supplying a simplified HTML string:
x.string = "<HTML><BODY><IMG WIDTH=31 HEIGHT=31 SRC=\"http://supercollider.sourceforge.net/images/icon.supercollider.gif\"><FONT SIZE=4><U>Hallo</U><BR><I>Welt</I></BODY>";