Can someone tell me why the self.websitemanual.OnEnter keeps having problems with the websiteselect?
[CODE]
self.HTMLselectbox = vgui.Create( "DFrame" )
self.HTMLselectbox:SetSize( 1000, 600 )
self.HTMLselectbox:SetTitle( "CHOOSE A WEBSITE!" )
self.HTMLselectbox:Center()
self.HTMLselectbox:ShowCloseButton( true )
self.HTMLselectbox:MakePopup()
self.HTMLloadpanel = vgui.Create( "DPanel", self.HTMLselectbox )
self.HTMLloadpanel:Dock(FILL)
function self.HTMLloadpanel:Paint( w, h )
draw.RoundedBox( 8, 0, 0, w, h, Color( 60, 60, 60 ) )
draw.DrawText("Loading...", "Trebuchet24", 500, 270, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
end
self.websitemanual = vgui.Create( "DTextEntry", self.HTMLloadpanel )
self.websitemanual:Dock(BOTTOM)
self.websitemanual:SetText( "https://www.google.com" )
self.websitemanual.OnEnter = function()
self.websiteselect:OpenURL(tostring( self.websiteselect:GetText() ))
end
self.websiteselect = vgui.Create( "DHTML", self.HTMLloadpanel )
self.websiteselect:Dock(FILL)
self.websiteselect:OpenURL( self.websitemanual:GetText() )
[/CODE]
What is the error? Tabs help reading the code:
[code]
self.HTMLselectbox = vgui.Create( "DFrame" )
self.HTMLselectbox:SetSize( 1000, 600 )
self.HTMLselectbox:SetTitle( "CHOOSE A WEBSITE!" )
self.HTMLselectbox:Center()
self.HTMLselectbox:ShowCloseButton( true )
self.HTMLselectbox:MakePopup()
self.HTMLloadpanel = vgui.Create( "DPanel", self.HTMLselectbox )
self.HTMLloadpanel:Dock(FILL)
function self.HTMLloadpanel:Paint( w, h )
draw.RoundedBox( 8, 0, 0, w, h, Color( 60, 60, 60 ) )
draw.DrawText("Loading...", "Trebuchet24", 500, 270, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
end
self.websitemanual = vgui.Create( "DTextEntry", self.HTMLloadpanel )
self.websitemanual:Dock(BOTTOM)
self.websitemanual:SetText( "https://www.google.com" )
self.websitemanual.OnEnter = function()
self.websiteselect:OpenURL(tostring( self.websiteselect:GetText() ))
end
self.websiteselect = vgui.Create( "DHTML", self.HTMLloadpanel )
self.websiteselect:Dock(FILL)
self.websiteselect:OpenURL( self.websitemanual:GetText() )
[/code]
Next, OnEnter is when you press Enter on the field, BUT you didn't enable keyboard input which can cause an issue...
call:
self.websiteselect:SetEditable( true );
or
self.websiteselect:SetKeyboardInputEnabled( true );
self.websiteselect:SetMouseInputEnabled( true );
Although, if you are able to type, this may not be the problem. Is there an error?
I don't need to SetKeyboardInputEnabled or MouseInput, because I make the HTMLselectbox a popup at line 6, which enables both. The error I get is:
Attempt to index field 'websiteselect' (a nil value)
Note this panel is not separate. It may be a nil value because I did something wrong with all the 'self' values everywhere (but, I don't think I would need self.self.websitemanual).
Wait, the problem was completely unrelated to this. [url]http://facepunch.com/showthread.php?t=1458089[/url]
Sorry, you need to Log In to post a reply to this thread.