Opening Derma windows with key.

I want to create a menu for my in-game addon. I want to make it open by clicking a button on keyboard, what you can set in this window too (I mean a button for opening window)… Can someone give me a code of something like that?

**[IN_KEYS

http://wiki.garrymsod.com/favicon.ico](http://wiki.garrysmod.com/?title=IN_KEYS)**

I made something for this once.

[lua]
if SERVER then
concommand.Add(“cl_keypress”,function(pl,cmd,args)
local n = tonumber(args[1])
hook.Call(“PlayerKeyPress”,GAMEMODE,pl,n)
end)
else
local keys_pressed = {}
hook.Add(“Think”,“CheckKeyPress”,function()
for i =1, 130 do
if input.IsKeyDown( i ) then
if keys_pressed* then return end
RunConsoleCommand( “cl_keypress”, i )
hook.Call(“PlayerKeyPress”,GAMEMODE,LocalPlayer(),i)
keys_pressed* = true
break
elseif keys_pressed* then keys_pressed* = nil
end
end
end)
end[/lua]

Here’s how you’d use it.
[lua]
hook.Add(“PlayerKeyPress”,“BindMenu”,function(pl,n)
if n == KEY_T then OpenMenu() end
end)
[/lua]