| 1 | |
| 2 | <refentry id="FLbutBank"> |
| 3 | <indexterm id="IndexFLbutBank"><primary>FLbutBank</primary></indexterm> |
| 4 | <refentryinfo><title>FLTK:Other</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>FLbutBank</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>FLbutBank</refname> |
| 13 | <refpurpose> |
| 14 | A FLTK widget opcode that creates a bank of buttons. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | 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. |
| 22 | The plugin repository can be found here: <ulink url="https://github.com/csound/plugins"><citetitle>https://github.com/csound/plugins</citetitle></ulink></para> |
| 23 | <para> |
| 24 | A FLTK widget opcode that creates a bank of buttons. |
| 25 | </para> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Syntax</title> |
| 30 | <synopsis>kout, ihandle <command>FLbutBank</command> itype, inumx, inumy, iwidth, iheight, ix, iy, \ |
| 31 | iopcode [, kp1] [, kp2] [, kp3] [, kp4] [, kp5] [....] [, kpN]</synopsis> |
| 32 | </refsect1> |
| 33 | |
| 34 | <refsect1> |
| 35 | <title>Initialization</title> |
| 36 | <para> |
| 37 | <emphasis>ihandle</emphasis> -- 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 <link linkend="ControlFltkAppearance"><citetitle>Modifying FLTK Widget Appearance</citetitle></link>). It is automatically output by <emphasis>FLbutBank</emphasis> 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.) |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>itype</emphasis> -- an integer number denoting the appearance of the widget. The valid numbers are: |
| 42 | <itemizedlist> |
| 43 | <listitem><para>1 - normal button</para></listitem> |
| 44 | <listitem><para>2 - light button</para></listitem> |
| 45 | <listitem><para>3 - check button</para></listitem> |
| 46 | <listitem><para>4 - round button</para></listitem> |
| 47 | </itemizedlist> |
| 48 | You can add 20 to the value to create a "plastic" type button. (Note that there is no Platic Round button. i.e. if you set type to 24 it will look exactly like type 23). |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | <emphasis>inumx</emphasis> -- number of buttons in each row of the bank. |
| 53 | </para> |
| 54 | |
| 55 | <para> |
| 56 | <emphasis>inumy</emphasis> -- number of buttons in each column of the bank |
| 57 | </para> |
| 58 | |
| 59 | <para> |
| 60 | <emphasis>ix</emphasis> -- horizontal position of upper left corner of the valuator, relative to the upper left corner of corresponding window, expressed in pixels |
| 61 | </para> |
| 62 | |
| 63 | <para> |
| 64 | <emphasis>iy</emphasis> -- vertical position of upper left corner of the valuator, relative to the upper left corner of corresponding window, expressed in pixels |
| 65 | </para> |
| 66 | |
| 67 | <para> |
| 68 | <emphasis>iopcode</emphasis> -- score opcode type. You have to provide the ascii code of the letter corresponding to the score opcode. At present time only <quote>i</quote> (ascii code 105) score statements are supported. A zero value refers to a default value of <quote>i</quote>. So both 0 and 105 activates the <link linkend="i"><citetitle>i</citetitle></link> opcode. A value of -1 disables this opcode feature. |
| 69 | </para> |
| 70 | </refsect1> |
| 71 | |
| 72 | <refsect1> |
| 73 | <title>Performance</title> |
| 74 | <para> |
| 75 | <emphasis>kout</emphasis> -- output value |
| 76 | </para> |
| 77 | |
| 78 | <para> |
| 79 | <emphasis>kp1</emphasis>, <emphasis>kp2</emphasis>, ..., <emphasis>kpN</emphasis> -- arguments of the activated instruments. |
| 80 | </para> |
| 81 | |
| 82 | <para> |
| 83 | The <emphasis>FLbutBank</emphasis> opcode creates a bank of buttons. For example, the following line: |
| 84 | <informalexample> |
| 85 | <programlisting> |
| 86 | gkButton,ihb1 FLbutBank 22, 8, 8, 380, 180, 50, 350, 0, 7, 0, 0, 5000, 6000 |
| 87 | </programlisting> |
| 88 | </informalexample> |
| 89 | |
| 90 | will create the this bank: |
| 91 | |
| 92 | <mediaobject> |
| 93 | <imageobject> |
| 94 | <imagedata fileref="images/flbutbank.png" format="PNG"/> |
| 95 | </imageobject> |
| 96 | |
| 97 | <textobject> |
| 98 | <phrase>FLbutBank.</phrase> |
| 99 | </textobject> |
| 100 | |
| 101 | <caption> |
| 102 | <para>FLbutBank.</para> |
| 103 | </caption> |
| 104 | </mediaobject> |
| 105 | </para> |
| 106 | |
| 107 | <para> |
| 108 | A click to a button checks that button. It may also uncheck a previous checked button belonging to the same bank. So the behaviour is always that of radio-buttons. Notice that each button is labeled with a progressive number. The <emphasis>kout</emphasis> argument is filled with that number when corresponding button is checked. |
| 109 | </para> |
| 110 | |
| 111 | <para> |
| 112 | <emphasis>FLbutBank</emphasis> not only outputs a value but can also activate (or schedule) an instrument provided by the user each time a button is pressed. If the <emphasis>iopcode</emphasis> argument is set to a negative number, no instrument is activated so this feature is optional. In order to activate an instrument, <emphasis>iopcode</emphasis> must be set to 0 or to 105 (the ascii code of character <quote>i</quote>, referring to the <link linkend="i"><citetitle>i</citetitle></link> score opcode). P-fields of the activated instrument are <emphasis>kp1</emphasis> (instrument number), <emphasis>kp2</emphasis> (action time), <emphasis>kp3</emphasis> (duration) and so on with user p-fields. |
| 113 | </para> |
| 114 | |
| 115 | <para> |
| 116 | The <emphasis>itype</emphasis> argument sets the type of buttons identically to the <link linkend="FLbutton"><citetitle>FLbutton</citetitle></link> opcode. By adding 10 to the <emphasis>itype</emphasis> argument (i.e. by setting 11 for type 1, 12 for type 2, 13 for type 3 and 14 for type 4), it is possible to skip the current <emphasis>FLbutBank</emphasis> value when getting/setting snapshots (see <link linkend="ControlFltkGeneral"><citetitle>General FLTK Widget-related Opcodes</citetitle></link>). You can also add 10 to "plastic" button types (31 for type 1, 32 for type 2, etc.) |
| 117 | </para> |
| 118 | <para> |
| 119 | FLbutBank is very useful to retrieve snapshots. |
| 120 | </para> |
| 121 | </refsect1> |
| 122 | <refsect1> |
| 123 | <title>Examples</title> |
| 124 | <para> |
| 125 | Here is an example of the FLbutBank opcode. It uses the file <ulink url="examples/FLbutBank.csd"><citetitle>FLbutBank.csd</citetitle></ulink>. |
| 126 | |
| 127 | <example> |
| 128 | <title>Example of the FLbutBank opcode.</title> |
| 129 | |
| 130 | |
| 131 | |
| 132 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 133 | <xi:include href="examples-xml/FLbutBank.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 134 | </example> |
| 135 | </para> |
| 136 | </refsect1> |
| 137 | <refsect1> |
| 138 | <title>See Also</title> |
| 139 | <para> |
| 140 | <link linkend="FLbox"><citetitle>FLbox</citetitle></link>, |
| 141 | <link linkend="FLbutton"><citetitle>FLbutton</citetitle></link>, |
| 142 | <link linkend="FLprintk"><citetitle>FLprintk</citetitle></link>, |
| 143 | <link linkend="FLprintk2"><citetitle>FLprintk2</citetitle></link>, |
| 144 | <link linkend="FLvalue"><citetitle>FLvalue</citetitle></link> |
| 145 | </para> |
| 146 | </refsect1> |
| 147 | |
| 148 | <refsect1> |
| 149 | <title>Credits</title> |
| 150 | <para>Author: &namegabriel;</para> |
| 151 | <para>New in version 4.22</para> |
| 152 | </refsect1> |
| 153 | </refentry> |