SwingOSC – Java-based GUI classes

This class is meant as an emulation of SCTextField. last mod: 17-jul-09 sciss
Also refer to JSCView for different behaviour affecting all widgets

no-op / not working
typingColornot effective
different behaviour
class hierarchyJSCTextField and JSCNumberBox are subclasses of JSCTextEditBase
known issues / todo
umlauteusing SuperCollider's defaultKeyDownAction mechanism prohibits the proper use of umlaute (basically everything above ASCII 127) ; until this is fixed, the defaultKeyDownAction has been commented out as to provide a better standard behaviour of the gadget ; press enter to commit edit and trigger action function

 

JSCTextField

Note: please use the abstraction layer TextField if possible!

A textfield allows the user to type in a line of arbitrary text (string) data.

(
    var w;
    
    w = JSCWindow( "JSCTextField" );
    b = JSCTextField( w, Rect( 10, 10, 150, 30 ));
    b.string = "hi there";
    b.action = { arg field; field.value.postln };
    w.front;
)

// does not do the action
b.value = "yo";
// does the action
b.valueAction = "lala";

b.boxColor = Color.grey;
b.stringColor = Color.white;
b.align = \center;

// note: action gets only called if the user presses
// return! if you want to be notified when the
// textfield looses its focus, you can use the focusLostAction:
b.focusLostAction = { arg field; [ "Lost focus", field.value ].postln };

default keyboard mappings

... not active at the moment! all keyboard events are handled by the look-and-feel (cursor, copy, paste, deleting etc.)

returncommit edit