• DPanel, there isn't the "board".
    4 replies, posted
Hello. Excuse me for any grammatical errors. I used this code: [CODE] local DPanel = vgui.Create( "DPanel" ) DPanel:SetPos( 10, 30 ) -- Set the position of the panel DPanel:SetSize( 200, 200 ) -- Set the size of the panel local DLabel = vgui.Create( "DLabel", DPanel ) DLabel:SetPos( 10, 10 ) -- Set the position of the label DLabel:SetText( "I'm a DLabel inside a DPanel! : )" ) -- Set the text of the label DLabel:SizeToContents() -- Size the label to fit the text in it DLabel:SetDark( 1 ) -- Set the colour of the text inside the label to a darker one [/CODE] It works, but I don't see the board: I should to see this: [IMG]http://wiki.garrysmod.com/images/e/ec/DPanel_large.png[/IMG] But I only see this: [IMG]http://wiki.garrysmod.com/images/3/38/DPanel.png[/IMG] Yes I see the message "I'm a DLabel inside a DPanel!" In the picture there isn't any message because I used the picture of gmod wiki! What's the problem? Thank you!
The DPanel is the white square. You should use the DFrame.
[QUOTE=geferon;50500914]The DPanel is the white square. You should use the DFrame.[/QUOTE] Thank you! How can I put my window in the DFrame?
The wiki can be outdated/broken sometimes- try this: [CODE] local Frame = vgui.Create( "DFrame" ) Frame:SetSize( 200, 200 ) -- Set the size Frame:Center() -- Center it Frame:MakePopup() -- Make it a popup so you can click it and stuff local Panel = vgui.Create( "DPanel", Frame ) Panel:Dock( FILL ) -- This just makes the panel fill the frame it's parented to local Lbl = vgui.Create( "DLabel", Panel ) Lbl:SetPos( 10, 10 ) -- Set the position of the label Lbl:SetText( "I'm a DLabel inside a DPanel! : )" ) -- Set the text of the label Lbl:SizeToContents() -- Size the label to fit the text in it Lbl:SetDark( 1 ) -- Set the colour of the text inside the label to a darker one [/CODE]
Solved! I deleted the DPanel and I added the DFrame: [CODE] local Panel = vgui.Create( "DFrame" ) Panel:SetPos( 100, 100 ) Panel:SetSize( 600, 600 ) Panel:SetTitle( "Window" ) Panel:SetDraggable( true ) Panel:MakePopup() local DLabel = vgui.Create( "DLabel", Panel ) DLabel:SetPos( 10, 10 ) DLabel:SetText( "A TEXT" ) DLabel:SizeToContents() DLabel:SetDark( 1 ) [/CODE]
Sorry, you need to Log In to post a reply to this thread.