Garry's Mod Wiki

Revision Difference

DProperty_Combo:Setup#515317

<function name="Setup" parent="DProperty_Combo" type="panelfunc">⤶ <ispanel>yes</ispanel>⤶ <description>Sets up a combo control.</description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="prop" type="string" default="Combo">The name of DProperty sub control to add.</arg>⤶ <arg name="data" type="table" default="{ text = \u0022Select...\u0022 }">Data to use to set up the combo box control.&#xA;&#xA;Structure:&#xA;* &lt;page&gt;string&lt;/page&gt; text - The default label for this combo box&#xA;* &lt;page&gt;table&lt;/page&gt; values - The values to add to the combo box</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Setup a Combo control with a custom default text and two options.</description>⤶ <code>⤶ local Combo = DP:CreateRow( "Catergory", "Hello World" )⤶ Combo:Setup( "Combo", {⤶ text = "Select me!",⤶ values = {⤶ [ "Label 1" ] = "data 1",⤶ [ "Label 2" ] = 2,⤶ }⤶ } )⤶ </code>⤶ ⤶ </example>