Garry's Mod Wiki

DProperty_Combo

Description

This is used internally - although you're able to use it you probably shouldn't.

DComboBox control for a DProperties panel.

Parent

Derives from DProperty_Generic.

Methods

DProperty_Combo:AddChoice( string Text, any data, boolean select = false )
Add a choice to your combo control.
DProperty_Combo:DataChanged( any data )
Called after the user selects a new value.
DProperty_Combo:SetSelected( number Id )
Set the selected option.
DProperty_Combo:Setup( string prop = "Combo", table data = { text = 'Select...' } )
Sets up a combo control.

Example

local Panel = vgui.Create( "DFrame" ) Panel:SetSize( 500, 500 ) Panel:MakePopup() local DP = vgui.Create( "DProperties", Panel ) DP:Dock( FILL ) local choice = DP:CreateRow( "Choices", "Combo #1: Default" ) choice:Setup( "Combo", {} ) choice:AddChoice( "Allow", true ) choice:AddChoice( "Disallow", false ) local choice = DP:CreateRow( "Choices", "Combo #2: Custom default text" ) choice:Setup( "Combo", { text = "Select type..." } ) choice:AddChoice( "Table", {} ) choice:AddChoice( "Function", function() end ) choice:AddChoice( "String", "Hello world" ) choice.DataChanged = function( self, data ) print( "You selected: ", data ) end

Page Links


Special Pages


Wikis

?

Render Time: 86ms

DB GetPage 47
Generate Html 6
SaveChanges (1) 10
Render Body 0
Render Sidebar 20