How could I keep the Dframe child in the foreground?
4 replies, posted
I'm trying to make an f4 menu, however when I click on the parent Dframe, the other put
themselves in the background, do you know how could I keep them in the foreground please ?
The Parent DFrame menu:
f4menu:SetSize( 1000, 790 )
f4menu:Center()
f4menu:SetVisible( true )
f4menu:MakePopup()
f4menu:SetDraggable( true )
f4menu:SetScreenLock( true )
f4menu:ShowCloseButton( false )
f4menu:SetBackgroundBlur( true )
f4menu:SetPaintShadow( true )
f4menu:SetTitle("")
f4menu:SetDeleteOnClose( true )
local x,y = f4menu:GetSize()
The Scroll DFrame menu:
local f4menumetier = vgui.Create( "DFrame", f4menu )
f4menumetier:SetSize(400,600)
f4menumetier:SetPos(x/2-150,y/2-250)
f4menumetier:MakePopup()
f4menumetier:SetDraggable( false )
f4menumetier:SetScreenLock( true )
f4menumetier:ShowCloseButton( false )
f4menumetier:SetTitle("")
f4menumetier:SetDeleteOnClose( true )
f4menumetier:SetVisible( true )
f4menumetier.Paint = function( self, w, h )
draw.RoundedBox( 20, 0, 0, w, h, Color(25,25,25,255))
end
local DScrollPanel = vgui.Create( "DScrollPanel", f4menumetier )
DScrollPanel:Dock( FILL)
DScrollPanel:SetSize(5,5)
for i=0, 15 do
local DButton = DScrollPanel:Add( "DButton" )
DButton:SetText( "Button #" .. i )
DButton:Dock(TOP)
DButton:SetSize(50,100)
DButton:DockMargin( 20, 0, 10, 15 )
DButton:SetColor(Color(25,25,25))
end
I hope you could help me, Thank you for reading and I apologize if my english is
ununderstandable !
You would need to remove this line:
f4menumetier:MakePopup()
since this function permanently detaches a panel from its parent (although it will still be removed at the same time as the parent).
You only need to call MakePopup() on the topmost parent.
Thank you, it worked!
I also have another problem if you could help me please!
I'm trying to SetImage a DImageButton but however I got an error instead of the png.
I did makes peoples downloading it: ( It's a Gamemode )
Init.lua:
resource.AddSingleFile( "material/icon/chercheur.png" )
But I can't figure out what to write in SetImage because I always get an error instead of the png picture:
f4menu:
local example = vgui.Create( "DImageButton", f4menu )
example:SetSize( 35, 35 )
example:SetPos( x - 85, y - 780 )
example:SetImage( "material/icon/chercheur.png" )
I hope you could there too, bring me help, thank you very much!
For the resource.AddSingleFile, the folder should be materials (with the s), so please check you have the correct path:
resource.AddSingleFile( "materials/icon/chercheur.png" )
The SetImage method is relative to the materials folder so you only need:
example:SetImage( "icon/chercheur.png" )
Ho alright ! , I didn't knew it was necessary for the gamemode to have precise folder names, the folder
name of my gamemode was : "material" , Thank you very much for your help!
Sorry, you need to Log In to post a reply to this thread.