Facepunch / garrysmod-issues

Garry's Mod issue tracker
147 stars 56 forks source link

PANEL:OnKeyCodePressed() doesn't work unless you do MakePopup(), but then it can't be parented #2606

Closed Nethie closed 8 years ago

Nethie commented 8 years ago

I'm in need to track buttons that player is using while my panel is focused - the issue is that it won't accept my input unless I do MakePopup(), which sadly unparents my panel from the frame and disallows me to SetParent() it back.

Mind you calling panel:SetKeyboardInputEnabled( true ) doesn't do any good. @edit Appearently it's still parented, just position is screwed.

robotboy655 commented 8 years ago
    local a = vgui.Create("DFrame")
    a:SetSize(500, 500)
    a:MakePopup()

    local b = vgui.Create("DPanel",a)

    b:RequestFocus()
    b.OnKeyCodePressed = print