# DComboBox:OnSelect

- **Ortam:** İstemci, Menü
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/DComboBox:OnSelect
- **Çeviri tarihi:** 2025-09-08

```lua
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](https://gmod.tr/wiki/number) **index**: Diğer [DComboBox](https://gmod.tr/wiki/DComboBox) fonksiyonlarıyla kullanılmak üzere seçeneğin indeksi.
2. [string](https://gmod.tr/wiki/string) **value**: Seçeneğin adı.
3. [any](https://gmod.tr/wiki/any) **data**: Seçeneğe atanan veri.

### Örnek

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

```lua
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
```

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/DComboBox:OnSelect
