DHTML/HTML Doesnt allow keyboard input?

Hello, I wanted to know why the hell the DHTML/HTML doesnt allow keyboard input anymore? It worked fine on my other code!

This is the base of it:


local html = vgui.Create("DHTML", dpanel)
html:SetSize(dpanel:GetWide() - dpanel:GetWide() / 4, dpanel:GetTall())
html:SetPos(dpanel:GetWide() / 4, 0)
html:OpenURL(defaulturl)

the defaulturl is my forum, but even when I set it to google, theres no keyboard input, only mouse input.

could it be because of the parenting? the HTML is paranted to a DPanel(for hiding/showing if needed), and that DPanel is paranted to another DPanel as base.

Try this

Panel:SetKeyboardInputEnabled

Did that already, didnt work.

bump?

I can’t see why Panel:SetKeyboardInputEnabled( true ) wouldn’t work. Perhaps you’re doing something wrong with it… code?


concommand.Add("testpanel", function(ply)
	--[[ BEGIN: BASE ]]--
	local base = vgui.Create("DPanel")
	base:SetSize(ScrW() - 100, ScrH() - 100)
	base:SetPos(50, 50)
	function base:Paint(w, h)
		draw.RoundedBox(4, 0, 0, w, h, Color(51, 51, 51))
		draw.RoundedBox(4, 0, 0, w, 25, Color(63, 63, 63))
	end
	base:MakePopup()

	local closebtn = vgui.Create("DButton", base)
	closebtn:SetSize(120, 25)
	closebtn:SetText("CLOSE")
	closebtn:SetPos(base:GetWide() - 120, 0)
	function closebtn:Paint(w, h)
		draw.RoundedBox(0, 0, 0, w, h, self.Hovered and Color(231,76,60) or Color(192,57,43))
	end
	function closebtn:DoClick()
		base:SetVisible(false)
	end
	--[[ END: BASE ]]--

	--[[ BEGIN: CHILD ]]--
	local dpanel = vgui.Create("DPanel", base)
	dpanel:SetSize(base:GetWide(), base:GetTall() - 25)
	dpanel:SetPos(0, 25)

	local dpanel2 = vgui.Create("DPanel", base)
	dpanel2:SetSize(base:GetWide(), base:GetTall() - 25)
	dpanel2:SetPos(0, 25)
	dpanel2:SetVisible(false)

	local togglebtn = vgui.Create("DButton", base)
	togglebtn:SetSize(120, 25)
	togglebtn:SetPos(0, 0)
	togglebtn:SetText("TOGGLE DPANEL")
	local toggled = true
	function togglebtn:DoClick()
		if toggled then
			dpanel:SetVisible(true)
			dpanel2:SetVisible(false)
			toggled = false
		else
			dpanel:SetVisible(false)
			dpanel2:SetVisible(true)
			toggled = true
		end
	end
	--[[ END: CHILD ]]--

	--[[ BEGIN: PARENTING - PANEL 1 ]]--
	local btnlist = vgui.Create("DScrollPanel", dpanel)
	btnlist:SetSize(dpanel:GetWide() / 4, dpanel:GetTall())
	local html = vgui.Create("HTML", dpanel)
	html:SetSize(dpanel:GetWide() - dpanel:GetWide() / 4, dpanel:GetTall())
	html:SetPos(dpanel:GetWide() / 4, 0)
	html:OpenURL(defaulturl)

	-- BEGIN: BUTTONS
	for _, v in pairs(buttons) do
		local btn = vgui.Create("DButton")
		btn:SetSize(btnlist:GetWide(), 50)
		btn:SetPos(0, 0  + ((_ - 1) * 51))
		btn:SetText("")
		btn:SetDisabled(v.Disabled or false)
		btn.Name = string.upper(v.Name or "ERROR")
		function btn:DoClick()
			html:OpenURL(v.URL)
		end
		function btn:Paint(w, h)
			if self:GetDisabled() then
				return
			end

			draw.RoundedBox(0, 0, 0, w, h, self.Hovered and (v.HoverCol or Color(52, 152, 219)) or (v.Col or Color(41, 128, 185)))
			draw.SimpleText(btn.Name, v.Font or "Trebuchet24", w/2, h/2, v.TextCol or Color(255, 255, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
		end
		btnlist:AddItem(btn)
	end
	-- END: BUTTONS

	--[[ END: PARENTING - PANEL 1 ]]--
end)

[editline]31st July 2015[/editline]

When I did “Panel:IsKeyboardInputEnabled()” then it returned true.

So where’s “Panel:IsKeyboardInputEnabled()” in that code?

its the code without it, before I had put inside the btn:DoClick() “print(Panel:IsKeyboardInputEnabled())” for each panel, and it returned true.

Can you just show us how you tried to implement it?



function togglebtn:DoClick()
	--[[if toggled then
		dpanel:SetVisible(true)
		dpanel2:SetVisible(false)
		toggled = false
	else
		dpanel:SetVisible(false)
		dpanel2:SetVisible(true)
		toggled = true
	end]]--
	print(base:IsKeyboardInputEnabled().." "..dpanel:IsKeyboardInputEnabled().." "..dpanel2:IsKeyboardInputEnabled().." "..html:IsKeyboardInputEnabled())
end


Bump…?

[editline]4th August 2015[/editline]

Could it be because my derma doesnt use DFrame, but DPanel instead?

[editline]4th August 2015[/editline]

Alright, its because of it being a DPanel.