FLtext — A FLTK widget opcode that creates a textbox.
FLtext allows the user to modify a parameter value by directly typing it into a text field.
ihandle -- a handle value (an integer number) that unequivocally references a corresponding widget. This is used by other opcodes that modify a widget's properties (see Modifying FLTK Widget Appearance). It is automatically output by FLtext and must not be set by the user label. (The user label is a double-quoted string containing some user-provided text placed near the widget.)
“label” -- a double-quoted string containing some user-provided text, placed near corresponding widget.
imin -- minimum value of output range.
imax -- maximum value of output range.
istep -- a floating-point number indicating the increment of valuator value corresponding to the mouse dragging. The istep argument allows the user to arbitrarily slow mouse motion, enabling arbitrary precision.
itype -- an integer number denoting the appearance of the valuator.
The itype argument can be set to the following values:
1 - normal behaviour
2 - dragging operation is suppressed, instead it will appear two arrow buttons. A mouse-click on one of these buttons can increase/decrease the output value.
3 - text editing is suppressed, only mouse dragging modifies the output value.
iwidth -- width of widget.
iheight -- height of widget.
ix -- horizontal position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
iy -- vertical position of upper left corner of the valuator, relative to the upper left corner of corresponding window (expressed in pixels).
kout -- output value
FLtext allows the user to modify a parameter value by directly typing it into a text field:
Its value can also be modified by clicking on it and dragging the mouse horizontally. The istep argument allows the user to arbitrarily set the response on mouse dragging.
Here is an example of the FLtext opcode. It uses the file FLtext.csd.
Example 290. Example of the FLtext opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
<CsoundSynthesizer> <CsOptions> ; Select audio/midi flags here according to platform ; Audio out Audio in No messages -odac -iadc -d ;;;RT audio I/O ; For Non-realtime ouput leave only the line below: ; -o FLtext.wav -W ;;; for file output any platform </CsOptions> <CsInstruments> ; A sine with oscillator with fltext box controlled ; frequency either click and drag or double click and ; type to change frequency value sr = 44100 kr = 441 ksmps = 100 nchnls = 1 FLpanel "Frequency Text Box", 270, 600, 50, 50 ; Minimum value output by the text box imin = 200 ; Maximum value output by the text box imax = 5000 ; Step size istep = 1 ; Text box graphic type itype = 1 ; Width of the text box in pixels iwidth = 70 ; Height of the text box in pixels iheight = 30 ; Distance of the left edge of the text box ; from the left edge of the panel ix = 100 ; Distance of the top edge of the text box ; from the top edge of the panel iy = 300 gkfreq,ihandle FLtext "Enter the frequency", imin, imax, istep, itype, iwidth, iheight, ix, iy ; End of panel contents FLpanelEnd ; Run the widget thread! FLrun instr 1 iamp = 15000 ifn = 1 asig oscili iamp, gkfreq, ifn out asig endin </CsInstruments> <CsScore> ; Function table that defines a single cycle ; of a sine wave. f 1 0 1024 10 1 ; Instrument 1 will play a note for 1 hour. i 1 0 3600 e </CsScore> </CsoundSynthesizer>