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:
[CODE]local html = vgui.Create("DHTML", dpanel)
html:SetSize(dpanel:GetWide() - dpanel:GetWide() / 4, dpanel:GetTall())
html:SetPos(dpanel:GetWide() / 4, 0)
html:OpenURL(defaulturl)[/CODE]
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 [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/SetKeyboardInputEnabled]Panel:SetKeyboardInputEnabled[/url]
Did that already, didnt work.
bump?
[QUOTE=whitestar;48333745]bump?[/QUOTE]
I can't see why [URL="http://wiki.garrysmod.com/page/Panel/SetKeyboardInputEnabled"]Panel:SetKeyboardInputEnabled( true )[/URL] wouldn't work. Perhaps you're doing something wrong with it.. code?
[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)[/CODE]
[editline]31st July 2015[/editline]
When I did "Panel:IsKeyboardInputEnabled()" then it returned true.
So where's "Panel:IsKeyboardInputEnabled()" in that code?
[QUOTE=JasonMan34;48337272]So where's "Panel:IsKeyboardInputEnabled()" in that code?[/QUOTE]
its the code without it, before I had put inside the btn:DoClick() "print(Panel:IsKeyboardInputEnabled())" for each panel, and it returned true.
[QUOTE=whitestar;48337370]its the code without it, before I had put inside the btn:DoClick() "print(Panel:IsKeyboardInputEnabled())" for each panel, and it returned true.[/QUOTE]
Can you just show us how you tried to implement it?
[code]
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
[/code]
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.
Sorry, you need to Log In to post a reply to this thread.