Garry's Mod Wiki

Revision Difference

DForm:ComboBox#513130

<function name="ComboBox" parent="DForm" type="panelfunc">⤶ <ispanel>yes</ispanel>⤶ <description>Adds a <page>DComboBox</page> onto the <page>DForm</page></description>⤶ <realm>Client</realm>⤶ <args>⤶ <arg name="title" type="string">Text to the left of the combo box</arg>⤶ <arg name="convar" type="string">Console variable to change when the user selects something from the dropdown.</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="Panel">The created <page>DComboBox</page></ret>⤶ <ret name="" type="Panel">The created <page>DLabel</page></ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <code>⤶ local frame = vgui.Create( "DFrame" )⤶ frame:SetSize( ScrW() / 2, ScrH() / 2 )⤶ frame:MakePopup()⤶ ⤶ local form = frame:Add("DForm")⤶ form:Dock( FILL )⤶ form:DockMargin( 5, 5, 5, 5 )⤶ ⤶ local combobox, label = form:ComboBox( "test", "sv_accelerate" )⤶ combobox:AddChoice( "10" ) -- 10 will be used as convar value⤶ combobox:AddChoice( "1000", 100 ) -- 100 will be used as convar value⤶ </code>⤶ ⤶ </example>