• DComboBox
    2 replies, posted
I am not sure how to use the DComboBox. How to make it do a certain action when clicking one of the choices. [lua] local choice = vgui.Create("DComboBox",modelbg) choice:SetSize(120,27) choice:SetPos(100,55) choice:SetValue("Select Option") choice:AddChoice("Check") choice:AddChoice("Jump") choice.OnSelect = function(index, value, data) print(data.." was selected") end [/lua] I used print to check which one is pressed and it tells me but not sure how to use make it do a certain acction when I click Check or Jump.
[lua] if data == "Check" then print(data.." was selected!") elseif data == "Jump" then yourcode end [/lua]
I am so stupid. I tried same thing with index and value but Idk why I didn't tried with data. Thanks.
Sorry, you need to Log In to post a reply to this thread.