DComboBox:OnSelect

  DComboBox:OnSelect( number index, string value, any data )

Açıklama

Açılır kutudaki bir seçenek seçildiğinde çağrılır. Bu fonksiyon tek başına bir şey yapmaz, üzerine yazmanız (overwrite) beklenir.

Argümanlar

1 number index
Diğer DComboBox fonksiyonlarıyla kullanılmak üzere seçeneğin indeksi.
2 string value
Seçeneğin adı.
3 any data
Seçeneğe atanan veri.

Örnek

Arka plan panelinin rengini kontrol eden bir açılır kutu oluşturur.

local frame = vgui.Create("DFrame") frame:SetSize( 500, 500 ) frame:Center() frame:MakePopup() -- Arka plan paneli local BGPanel = vgui.Create( "DPanel", frame ) BGPanel:Dock( FILL ) local cbox = vgui.Create( "DComboBox", BGPanel ) cbox:SetPos( 5, 5 ) cbox:SetSize( 190, 20 ) cbox:SetValue( "Pick a color" ) -- Varsayılan metin -- Renk seçenekleri cbox:AddChoice( "Red", Color( 255, 0, 0 ) ) cbox:AddChoice( "Orange", Color( 255, 128, 0 ) ) cbox:AddChoice( "Yellow", Color( 255, 255, 0 ) ) cbox:AddChoice( "Green", Color( 0, 255, 0 ) ) cbox:AddChoice( "Blue", Color( 0, 0, 255 ) ) cbox:AddChoice( "Indigo", Color( 64, 0, 255 ) ) cbox:AddChoice( "Violet", Color( 128, 0, 255 ) ) cbox:AddChoice( "Pink", Color( 255, 0, 255 ) ) function cbox:OnSelect( index, text, data ) -- Arka plan panelinin rengini ayarla BGPanel:SetBackgroundColor( data ) end

Tüm sunucular · GmodTR Launcher · Rehber · GMod Wiki · GmodTR nedir? · Sunucu ekle · Discord