• VGUI Confusion..
    7 replies, posted
Is there a way to check if a panel is open? I've checked and I couldn't find anything...
[lua] if !TeamMenu.Open then -- If the menu is closed, then TeamMenu:MoveTo(ScrW() / 2 - 250, ScrH() / 2 - 200, 1.6, 0,1) -- When you open it, it will slide trough the screen, not teleport. end -- Ending the 'IF' [/lua] From my tutorial on GMod wiki. [url]http://wiki.garrysmod.com/?title=Persious%27s_team_menu_guide[/url]
[QUOTE=Persious;29930453][lua] if !TeamMenu.Open then -- If the menu is closed, then TeamMenu:MoveTo(ScrW() / 2 - 250, ScrH() / 2 - 200, 1.6, 0,1) -- When you open it, it will slide trough the screen, not teleport. end -- Ending the 'IF' [/lua] From my tutorial on GMod wiki. [url]http://wiki.garrysmod.com/?title=Persious%27s_team_menu_guide[/url][/QUOTE] I would not listen to this guy.
Unfortunately it doesn't seem like there's a Panel.GetVisible function, so you can't tell if the panel is hidden. However, you can check if a panel exists just by comparing it to nil (the value it'll be if it's been removed). [lua]if panel then print("my panel exists!"); end[/lua]
[QUOTE=Wizard of Ass;29933133]I would not listen to this guy.[/QUOTE] Why?
[QUOTE=Persious;29968281]Why?[/QUOTE] Because you're an idiot
[QUOTE=Entoros;29933844]Unfortunately it doesn't seem like there's a Panel.GetVisible function, so you can't tell if the panel is hidden. However, you can check if a panel exists just by comparing it to nil (the value it'll be if it's been removed). [lua]if panel then print("my panel exists!"); end[/lua][/QUOTE] Or you could use a panel:IsValid(), because the panel doesn't have to be nil to be null, if it was null it would pass the "if panel" check.
[QUOTE=Entoros;29933844]Unfortunately it doesn't seem like there's a Panel.GetVisible function[/QUOTE] [b][url=http://wiki.garrysmod.com/?title=Panel.IsVisible]Panel.IsVisible [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]
Sorry, you need to Log In to post a reply to this thread.