• Help with PANEL:OnKeyCodePressed( number keyCode )
    3 replies, posted
Hello, I am trying to figure out how to check what key has been pressed... PANEL/OnKeyCodePressed I found that but am unsure how to use it as it provides no examples and so far my testing didn't work... Maybe it is just because I am tired and cant think straight or just a retard in general lol. Also, I dont want to use GM/KeyPress as that only works with IN_ Enums keys as far as I know... Any help is appreciated...
As the wiki says, it can only be used on a panel, or DPanel. So for example if you had, local pnl = vgui.Create("DPanel") pnl:SetSize(150, 150) pnl:SetPos(0, 0) function pnl:OnKeyCodePressed(keyCode) -- do stuff here end
Did you enable keyboard input on the panel using Panel/SetKeyboardInputEnabled?
No, I didnt even know about this... I will test it out once I get a chance thanks...
Sorry, you need to Log In to post a reply to this thread.