FLbox

FLbox — A FLTK widget that displays text inside of a box.

Description

Plugin opcode in widgets. This opcode is part of the plugin repository and has to be installed separately. These FLTK widgets do not work on the Mac. The plugin repository can be found here: https://github.com/csound/plugins

A FLTK widget that displays text inside of a box.

Syntax

ihandle FLbox "label", itype, ifont, isize, iwidth, iheight, ix, iy [, image]
ihandle FLbox istr, itype, ifont, isize, iwidth, iheight, ix, iy [, image]

Initialization

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 FLbox 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.

istr -- an i-value that is used to get a string via strset, placed near corresponding widget.

Notice that with FLbox, it is not necessary to call the FLsetTextType opcode at all in order to use a symbol. In this case, it is sufficient to set a label starting with @ followed by the proper formatting string.

The following symbols are supported:

FLTK label supported symbols.

FLTK label supported symbols.

The @ sign may be followed by the following optional formatting characters, in this order:

  1. # forces square scaling rather than distortion to the widget's shape.

  2. +[1-9] or -[1-9] tweaks the scaling a little bigger or smaller.

  3. [1-9] rotates by a multiple of 45 degrees. 6 does nothing, the others point in the direction of that key on a numeric keypad.

itype -- an integer number denoting the appearance of the widget.

The following values are legal for itype:

  • 1 - flat box

  • 2 - up box

  • 3 - down box

  • 4 - thin up box

  • 5 - thin down box

  • 6 - engraved box

  • 7 - embossed box

  • 8 - border box

  • 9 - shadow box

  • 10 - rounded box

  • 11 - rounded box with shadow

  • 12 - rounded flat box

  • 13 - rounded up box

  • 14 - rounded down box

  • 15 - diamond up box

  • 16 - diamond down box

  • 17 - oval box

  • 18 - oval shadow box

  • 19 - oval flat box

ifont -- an integer number denoting the font of FLbox.

ifont argument to set the font type. The following values are legal for ifont:

  • 1 - helvetica (same as "Arial" under Windows)

  • 2 - helvetica bold

  • 3 - helvetica italic

  • 4 - helvetica bold italic

  • 5 - courier

  • 6 - courier bold

  • 7 - courier italic

  • 8 - courier bold italic

  • 9 - times

  • 10 - times bold

  • 11 - times italic

  • 12 - times bold italic

  • 13 - symbol

  • 14 - screen

  • 15 - screen bold

  • 16 - dingbats

isize -- size of the font.

iwidth -- width of widget.

iheight -- height of widget.

ix -- horizontal position of the upper left corner of the valuator, relative to the upper left corner of corresponding window. (Expressed in pixels.)

iy -- vertical position of the upper left corner of the valuator, relative to the upper left corner of corresponding window. (Expressed in pixels.)

image -- a handle referring to an eventual image opened with bmopen opcode. If it is set, it allows a skin for that widget.

[Note] Note about the bmopen opcode

Although the documentation mentions the bmopen opcode, it has not been implemented in Csound 4.22.

Performance

FLbox is useful to show some text in a window. The text is bounded by a box, whose aspect depends on itype argument.

Note that FLbox is not a valuator and its value is fixed. Its value cannot be modified.

Examples

Here is an example of the FLbox opcode. It uses the file FLbox.csd.

Example 312. Example of the FLbox 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 FLbox.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
kr = 441
ksmps = 100
nchnls = 1

FLpanel "Text Box", 700, 400, 50, 50
    ; Box border type (7=embossed box)
    itype = 7
    ; Font type (10='Times Bold')
    ifont = 10
    ; Font size
    isize = 20 
    ; Width of the flbox
    iwidth = 400
    ; Height of the flbox
    iheight = 30
    ; Distance of the left edge of the flbox
    ; from the left edge of the panel
    ix = 150
    ; Distance of the upper edge of the flbox
    ; from the upper edge of the panel
    iy = 100

    ih3 FLbox "Use Text Boxes For Labelling", itype, ifont, isize, iwidth, iheight, ix, iy
; End of panel contents
FLpanelEnd
; Run the widget thread!
FLrun

instr 1
endin


</CsInstruments>
<CsScore>

; Real-time performance for 1 hour.
f 0 3600
e


</CsScore>
</CsoundSynthesizer>


See Also

FLbutBank, FLbutton, FLprintk, FLprintk2, FLvalue

Credits

Author: Gabriel Maldonado

New in version 4.22

Example written by Iain McCurdy, edited by Kevin Conder.