It’s probably something simple that I’m overlooking but I’ve enabled SetKeyboardInputEnabled on the DFrame, RequestFocus( ), and MakePopup( ). I tried tying into OnEnter, PANEL:Think( ), and OnKeyPressed( ) with no results.
Here’s my Think. Essentially I have a scoreboard that I can hold TAB to open, and when I let go before 1/4 second is up it stays open as designed. If it’s held and released after 1/4 second, it stays open. I’d like to add functionality to close the panel if TAB is pressed within the panel.
[lua]function PANEL:Think( )
if ( CurTime( ) - SCOREBOARD_TIME_OPENED < SCOREBOARD_TIME_OPENED_TAP_DELAY ) then return; end
// KeyDown doesn’t detect in VGUI doesn’t detect
if ( LocalPlayer( ):KeyDown( IN_SCORE ) ) then
// This code crashes Garry's Mod when uncommented; CTD -- if ( input.IsKeyDown( IN_SCORE ) ) then -- self:Remove( ) -- end
Everything works as designed, but I can’t detect tab or other keys from within the DFrame. Probably something simple, but I can’t find any information on this in the wiki or on these forums through Google searches.