Input which can bind a command to a key. Used for binding inputs and outputs of TOOLs.
Derives methods, etc not listed on this page from DButton.
Gets the code of the key currently bound by the DBinder. Same as DBinder:GetValue.
Gets the code of the key currently bound by the DBinder. Same as DBinder:GetSelectedNumber.
DBinder:SetSelectedNumber( number keyCode )
Sets the current key bound by the DBinder, and updates the button's text as well as the ConVar.
This is used internally - although you're able to use it you probably shouldn't. Used to set the text of the DBinder to the current key binding, or NONE.
Creates a DBinder that prints to the player's chat when a new key is bound.
local frame = vgui.Create("DFrame") frame:SetSize(250,100) frame:Center() frame:SetTitle("DBinder Example") frame:MakePopup() local binder = vgui.Create( "DBinder", frame ) binder:SetSize( 200, 50 ) binder:SetPos( 25, 35 ) function binder:OnChange( num ) LocalPlayer():ChatPrint("New bound key: "..input.GetKeyName( num )) end