• attempt to call method 'IsVisible' (a boolean value)
    2 replies, posted
Hi ! I'm having trouble with DPanel and IsVisible Here is my code : cl_init.lu [CODE]local MENU = {} local F4_FRAME function MENU:OpenF4Menu() if F4_FRAME and ValidPanel( F4_FRAME ) then print("F4_FRAME is set and is ValidPanel") F4_FRAME:SetVisible( true ) F4_FRAME:Show() else print("F4_FRAME is not set and/or is not ValidPanel") F4_FRAME = vgui.Create("RICKY_F4Menu") F4_FRAME:SetVisible( true ) F4_FRAME:Show() end end function MENU:CloseF4Menu() print("Called MENU:CloseF4Menu") if F4_FRAME then F4_FRAME:SetVisible( false ) F4_FRAME:Hide() end end function MENU:HandleF4Menu() if not ValidPanel( F4_FRAME ) or not F4_FRAME:IsVisible() then MENU:OpenF4Menu() else MENU:CloseF4Menu() end end hook.Add( "ShowSpare2", "OpenF4Menu", MENU.HandleF4Menu )[/CODE] cl_frame.lua : [CODE]local PANEL = {} PANEL.IsVisible = false function PANEL:Init() timer.Simple( 0.2, function() PANEL.IsVisible = true end) self:SetSize( 900, 650 ) self:SetTitle( "" ) self:SetVisible( true ) self:SetDraggable( false ) self:ShowCloseButton( true ) self:SetDeleteOnClose( false ) self:MakePopup() self:Center() end function PANEL:Think() if PANEL.IsVisible == true and input.IsKeyDown ( KEY_F4 ) then self:SetVisible( false ) self:Hide() PANEL.IsVisible = false end end vgui.Register( "RICKY_F4Menu", PANEL, "DFrame" )[/CODE] First iteration is fine, HandleF4Menu is called then OpenF4Menu is called, when i re-press F4 my DFrame is closed but when i press F4 to re-open my DPanel lua throw an error at me : [CODE]attempt to call method 'IsVisible' (a boolean value)[/CODE] I don't understand why :( Thanks in advance !
You're overriding the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/IsVisible]Panel:IsVisible[/url] method.
Omg didn't even notice that ! Thanks a lot, i'm so dumb ahha ! Love you txike xd
Sorry, you need to Log In to post a reply to this thread.