• DButton non capable when created insite a panel?
    6 replies, posted
For some reason, my button won't show up. It's being created inside of a panel function. Can anyone explain this? [lua] function PANEL:MakeArrows() local panel = self local Left = vgui.Create("DButton") Left:SetParent(panel) Left:SetText("<") Left:SetPos(w/2 - (panel:GetWide() / 2) - 2, panel:GetTall()) Left:SetSize(100, 100) Left.DoClick = function() -- RunConsoleCommand("say", "Hi") end print("hi") end [/lua]
-snip- I think it is the position you are setting the button to. You are setting its y position to panel:GetTall(). If the top of the button is set to the bottom of the panel then the button itself will be hanging below the panel / invisible.
Will the button not appear if created inside of a panel function? the whole point is to create the button outside of the box.
[QUOTE=Archemyde;42921283]Will the button not appear if created inside of a panel function? the whole point is to create the button outside of the box.[/QUOTE] It is 'appearing', it's just doing it offscreen/out-of-bounds. Where you are setting its position, change panel:GetTall() to panel:GetTall()-100 and it should show up.
I don't think objects that are parented to panels can draw outside of those panels. Unparent it from the panel. You will also have to remove it manually when the panel is closed.
Lets say there are more than one "left" panels. When i go to remove it, will it remove all instances? or do i need to create specifically named panels for all instances?
[QUOTE=Archemyde;42922114]Lets say there are more than one "left" panels. When i go to remove it, will it remove all instances? or do i need to create specifically named panels for all instances?[/QUOTE] Put them into a table and remove everything in that table using for-loop when needed. Or parent them to a new (transparent) panel and remove that panel.
Sorry, you need to Log In to post a reply to this thread.